By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,230 Members | 2,436 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,230 IT Pros & Developers. It's quick & easy.

Call Java from JavaScript, and get back results (Lucene)

P: n/a
Hi, all.

I know that there is a way of using JavaScript to call a Java method,
and for the JavaScript to collect some sort of response from the Java,
as I had a page working a few years ago that used Java to read a file
from the filesystem then the JavaScript formatted the contents of the
file (a simple list) by wrapping HTML tags round certain fields.

Now, I am trying to make an HTML page that presents a query form, that
would then pass the query to Lucene and present the results in an HTML
page.

The final application is a searchable CD containing HTML and PDF
documents.

So far, I have a working version of Lucene, I can build an index and
search from the command line.

I cannot use a webserver, so all the examples and tutorials that I
have found so far, relying on Tomcat, are unhelpful.

Can anybody help me out, or point me to a tutorial on the mechanism
for using Java and JavaScript together?

Thanks in advance.. (and apologies for using Google to post to Usenet).

Apr 11 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
ke**********@yahoo.com wrote:
I cannot use a webserver, so all the examples and tutorials that I
have found so far, relying on Tomcat, are unhelpful.

Can anybody help me out, or point me to a tutorial on the mechanism
for using Java and JavaScript together?
As far as I know there is nothing special about HTML served up by a webserver
for this purpose. If the HTML that the browser is rendering is in the local
filesystem, and if the applet (jar file, or .class files) is also on the local
filesystem, then the APPLET tag will work just the same, and Java/JavaScript
will talk to each other in just the same way, as would be the case if both were
pulled off a webserver by HTTP.

Note "work just the same" does not necessarily imply "work well". I think you
may have problems using Lucene from an HTML page, unless you can ensure that
the user stays on the same page throughout. (I'm not sure, but I /suspect/
that changing pages might cause problems by closing down the applet -- thus
potentially loosing Lucene's state.)

-- chris
Apr 13 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.