This week's book giveaway is in the OCAJP forum.
We're giving away four copies of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) and have Khalid A Mughal & Rolf W Rasmussen on-line!
See this thread for details.
Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP 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