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

Call a Java method from Javascript

P: n/a
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!

Jun 5 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
mh****@gmail.com 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
Jun 6 '06 #2

P: n/a
You are right in that it was a bit strange. I think I have found a
better and more conventional approach.

Thanks.

Jun 6 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.