Call a Java method from Javascript

Discussion in 'Javascript' started by mhust6@gmail.com, Jun 5, 2006.

  1. Guest

    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, 2006
    #1
    1. Advertising

  2. Erwin Moller Guest

    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
     
    Erwin Moller, Jun 6, 2006
    #2
    1. Advertising

  3. hust6 Guest

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

    Thanks.
     
    hust6, Jun 6, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?ISO-8859-1?Q?Thomas_Gagn=E9?=
    Replies:
    9
    Views:
    11,254
    Jezuch
    Jul 3, 2003
  2. mcdeveloper
    Replies:
    1
    Views:
    4,228
    mcdeveloper
    Jun 13, 2006
  3. Ian
    Replies:
    2
    Views:
    349
    Ulrich Petri
    Sep 6, 2003
  4. BigZero
    Replies:
    5
    Views:
    6,427
    copernic777
    May 9, 2008
  5. Paka Small
    Replies:
    15
    Views:
    939
Loading...

Share This Page