• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

button onclick event

 
Lisa D'Aniello
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm brand new at this, and somewhat overwhelmed, so please bear with me. Is the following possible?
<Input type="button" value="Run Function" onKlick="<%runJavaMethod();%&rt;"&rt;
I'v tried it unsucessfully and It's driving me bonkers. Shouldn't you be able to set an HTML button's on click event to a Java method so long as you make the call from inside of the scriptlets? I don't want it to print anything, I just want it to do something. How would I go about calling a java method from a button on a jsp page?
Thank you,
Lisa
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65342
97
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, you cannot.
All of the Java in your JSP page executes on the server in order to compose an HTML page to send to the client. Once sent, your page is just an HTML page like any other and cannot call any Java that resides on the server.
hth,
bear
 
sonu arya
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the HTML code mentioned by Lisa I see something new. Please note the text in BOLD. ->
<Input type="button" value="Run Function" onKlick="<%runJavaMethod();%&rt;"&rt;
--------------------------------------
I feel it should be 'C' in place of 'K'.
--------------------------------------
And regarding this situation, Lisa, if you can make this Java method a JavaScript function then yo can call it the way you are doing right now.
Hope this helps!!
Thanks,
Manish
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65342
97
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I feel it should be 'C' in place of 'K'.

Yes, of course. Lisa wrote it that way because the UBB posting code will filter out the correct spelling (along with a lot of other HTMLisms).
bear
P.S. Lisa, correct me if that was not your intent.
[ October 02, 2003: Message edited by: Bear Bibeault ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic