473,748 Members | 2,328 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

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
1 3084
ke**********@ya hoo.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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
2582
by: Phil Powell | last post by:
URL: http://valsignalandet.com/cookiegrab.php?name=valIdentifier This page produces a cookie value and sends it back as HTML using PHP and Javascript to obtain it. This URL will be used as the value for a URLConnection object in a Java class to obtain the results of this page to get, of all things, a cookie value. Simply put: it's the ONLY way I know of where I can use Java to ultimately obtain a cookie since this is an application...
9
5731
by: Martin Waller | last post by:
Hello, I've been playing with the idea of just how to use an ASP page to provide a remote function call. In an ideal world this would be a web service but how can you do it if restricted to ASP 3.0 ? Idea 1 was to write an ASP page that accepted arguments using the classic ?X=1&Y=2 type of strings and have the page return an ADO disconnected record set containing the results of the action. This is call very well, and works, but you do...
3
2352
by: Robert Brown | last post by:
Hi All.. What I have is a normal ASP web page wih javascript. The javascript needs to call a payment gateway, but the only way to get to it is https://paymentgateway/external.pl with parameters. What is returned is a string containing several lines of information. This information I need to formulate into my own page.. At present, I use document.location = https..... but of course this
39
6546
by: Randell D. | last post by:
Folks, I'm sure this can be done legally, and not thru tricks of the trade - I hope someone can help. I'm writing a 'tool' (a function) which can be used generically in any of my projects. When it completes, it can call a success, or a failure function. The names of these success, or failure functions will differ, and I'd like to know how I can pass the name of a function to my tool, and how my tool can call the function, using that...
2
2596
by: mhust6 | last post by:
I am trying to call a java method from within my Javascript, but cannot seem to get it to work. All the examples I have found online and in the forums are using Java applets. I have a method that I want to call that does a search, and produces a message dialog displaying the results. Also, the class file lives next to the html file. How would I invoke this in my code? This is what I have now: <script> function searchStrings(){
0
2866
by: dashprasannajit | last post by:
package djvusearching; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import org.apache.lucene.analysis.cjk.CJKAnalyzer; //import org.apache.lucene.analysis.standard.StandardAnalyz er; import org.apache.lucene.queryParser.ParseException;
9
41722
by: misdst23 | last post by:
Hi, I know I can call a static java method within javascript by using the <% ... %tags. But how can pass a javascript variable ? function thefunction() { var = javascriptvariable ;
4
3873
by: Ty | last post by:
Hello all, I am creating a web site with Visual Stuido 2008. I am trying to use a java script file to create a busybox for login from this page http://blogs.crsw.com/mark/articles/642.aspx. I am using a master page senerio. The erro I'm getting is 'busyBox' is not a member of 'ASP.login2_aspx'
0
1996
by: davidvikimca | last post by:
Dear sir, I am trying some simple programs for search using lucene. I am trying to use SnowballAnalyzer in my search for "English" Language. I am using lucene-2.4.0 . On execution of this line--> " import org.apache.lucene.analysis.snowball.SnowballAnalyzer; " it shows error as package doesnt exist. I have downloaded this jar file (lucene-snowball-2.4.0.jar )and kept in my jdk class path . But still it shows error as...
0
8983
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8822
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9528
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9359
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9310
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9236
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6072
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4863
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2206
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.