Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > Call a Java method from Javascript

Reply
Thread Tools

Call a Java method from Javascript

 
 
mhust6@gmail.com
Guest
Posts: n/a
 
      06-05-2006
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(){
Searcher.search();
}
</script>
<form>
<input type="button" value="Search" onclick=searchStrings()>
</form>


I am bad with both HTML and Javascript, so I would appreciate any help
that can be offered.

Thanks!

 
Reply With Quote
 
 
 
 
Erwin Moller
Guest
Posts: n/a
 
      06-06-2006
http://www.velocityreviews.com/forums/(E-Mail Removed) wrote:

> 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.


Yes. What else?
You cannot call some method in some JVM somewhere else.
If you want JS to communicate with Java, you are talking about Java as an
applet, embedded in a html page.


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.


What does that excactly mean? 'lives next to the html file' ??

I get the feeling you are trying to accomplish something strange.
Please clarify.

Regards,
Erwin Moller
 
Reply With Quote
 
 
 
 
hust6
Guest
Posts: n/a
 
      06-06-2006
You are right in that it was a bit strange. I think I have found a
better and more conventional approach.

Thanks.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Poll: Is a Java Method an Instance of the Java Classjava.lang.reflect.Method? Please reply with YES or NO. Paka Small Java 15 02-07-2012 07:04 PM
Call Java Method from javascript BigZero Java 5 05-09-2008 12:09 PM
Javascript -> Applet: variable reset after method call from javascript?! mcdeveloper Java 1 06-13-2006 08:34 AM
Help with a utility class and having a method call another method from within Ian Python 2 09-06-2003 03:35 PM
How to call an instance method from a static method allowing overrides? =?ISO-8859-1?Q?Thomas_Gagn=E9?= Java 9 07-02-2003 11:04 PM



Advertisments