July 11th, 2000, 04:02 PM
value=" Save "
If I intend to use my ActionServlet to
perform both 'calculate' and 'save'
functionalities, I need to know
which 'submit' button is hit. So,
How do I know which one is hit via
the 'name' property--or some other
Is this possible?
OR, is it possible to associate
two servlets to two submit-buttons
for a single form?
It seems CGI guys do use two named
submit buttons with a single form.
Am I right in this?
Thanks in advance.
Comments on this post
July 15th, 2000, 10:47 PM
Hi, the best solution i can think of is manipulating the form in the client side, by doing this:
As you can imagine if you click the first button you will get some values for the form fields (using hidden fields could be good idea) and if you click the second one you get other values, doing this the servlet will "know" wich submit has been clicked.
An example function to manipulate form values is:
<input type=submit name=calculate value=""
<input type=submit name=save value=""
this code is not tested, but is something like that
Hope it helps.
July 17th, 2000, 01:45 PM
Thanks a lot to you for your answer which
sparked me into yet another solution
to my origninal question:
if I put
then I can use
to get the 'value' of the clicked submit
button. In such way, I can know which
submit-typed button is clicked and fire a
corresponding action inside the
Thank you again, Ottox. Keep cool!