0

I have 2 submit buttons in a jsp page. in the form action, i forward the request to a servlet. N in the servlet, i need to write logic for the respective button clicked in the previous jsp and redirect to a new jsp... Kindly help me with this... I am new to jsp n servlets......

4
Contributors
4
Replies
5
Views
8 Years
Discussion Span
Last Post by gaya123
0

you could use javascript for it...

u can have a hidden field who's value changes on the button click..
and then you pass this value to the next page and depending upon the value passed
write your logic..

this should be your html

<input type='hidden' id='thisone' name='thisone' value='0'>

this should be the javascript function

function cvalue()
  {
   document.getElementById('thisone').value="1";
 }

and this is what the buttons should be like

<input type='submit' value='submit1' >
<input type='submit' value='submit2' onClick='cvalue()'>

and on the second page you use the value of the field thisone
if its 0 means submit1 was clicked and if its 1 submit2 was clicked..


hope it helps...

0

I have 2 submit buttons in a jsp page. in the form action, i forward the request to a servlet. N in the servlet, i need to write logic for the respective button clicked in the previous jsp and redirect to a new jsp... Kindly help me with this... I am new to jsp n servlets......

If you took care in searching before posting you would found this recent thread

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.