Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Code checks "submit" type button

 
Ivan Turner
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The code "if(request.getParameter("post") != null )" and "if(request.getParameter("addBulletin") != null" is testing whether a button was clicked within jsp. How does a button become not null and with what not null value is it populated? I can't find the answer on google.
Thanks
 
Ivan Turner
Ranch Hand
Posts: 37
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A quick out.println("**"+request.getParameter("post")+"**"); indicated that the value attribute of the input tag not only shows as the button's text but it is also the value associated with getParameter. I didn't need google after all!!!
 
Ashwini Kashyap
Ranch Hand
Posts: 90
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Ivan,

The approach with which you are checking the click event of the button is absolutely incorrect.
Make use of javascript or JQuery to check events like button clicked and so on.

If you choose javascript then you may make use of onclick() event of button and then invoke its function for the same.

Let me know if you have any further concerns.

Thanks and Regards,
Ashwini Kashyap
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic