Calling java from javascript

Hello, all!

I looked thru many posts here and elsewhere, and maybe I’m just trying to find a simpler solution. This is the story:

I have a java script (notice the space…) in a java script library. Basically, it returns the number of pages in a pdf file as an integer.

I would like to be able to call it using javascript (different language than above), where I have all my other validation.

Any ideas? I’m fairly proficient at javascript, but not java.

Thanks, in advance!

Steve in NYC

“We anticipate a global world-market with place for perhaps five computers.” - Tom Watson, IBM 1949.

Subject: Calling java from javascript

Hello Steve,

if you want to call your Java code inside the web browser, then have several options, e.g.

(1) Client side: wrap your Java code into an applet class. From JavaScript you can then call any public methods of your applet.

(2) Server side: wrap your Java code into a Web-Java-Agent that returns the result in the result-content and call it with an AJAX-like mechanism

If you want to call your Java code in the Notes client, then there are several other options, e.g.

(3) Write a Java-Agent that write the result to the current document and call the agent from LotusScript

(4) Use LS2J to call methods in Java classesfrom LotusScript

I’m sure others know many other or similar ways to call Java…

Hope this helps. Have a great day!

Best regards,

Kurt

Subject: RE: Calling java from javascript

Hello!

Thanks for getting back to me! It’s for the web, and I think client side would be better.

A co-worker of mine will create the applet, so how could I get a handle in javascript? In a perfect world, I’d like to have something like:

var v_obj = document.getElementByID(“appletName”);

var v_NbPages = new Number( v_obj.pdfNbPages()); // ???

if( v_NbPages > 25) {

alert(“Too many pages! Please remove every 3rd word.”);

return false;

};

Any good reference sites?

Thanks, in advance!

Steve in NYC

“It hurts to be on the cutting edge.”

Subject: RE: Calling java from javascript

Hi Steve,

for german speakers, there is a good explanation here:

http://de.selfhtml.org/javascript/objekte/applets.htm

And here is an english example:

http://www.javareference.com/jrexamples/viewexample.jsp?id=81

Hope this helps. Have a great day!

Best regards,

Kurt

Subject: RE: Calling java from javascript

Hello!

Thanks! That’s just what I was looking for! I knew it wasn’t going to be that tough, I just couldn’t find the proper way to do it. =8P

So, once my co-worker makes the little applet, I’ll embed it (1x1), just to get a handle on the function. We shall see…

Take care & have a good day!

Steve in NYC

“All my life, I wanted to be someone. I guess I should have been more specific.”

Subject: New problem?: Calling java from javascript

Hello!

Well, it looks like we might have a new problem with this. =8( The java code basically counts the number of pages on a pdf. I want to use javascript to validate it. For example, if NbPages > 10, then don’t save the attachment.

My question is, will the applet be allowed to get a handle on the pdf file in question? Or will windows security prevent it?

Thanks, in advance!

Steve in NYC