Detecting button value

Hi experts,

Is there any way that I can detect button's value attribute in html:submit? for example:

          <td align="center"><html:submit  property="method" value="Save"/></td>
          <td align="center"><html:submit  property="method" value="Update"/></td>

How do detect whether user press save button or update button in side of ActionForward?

thx,
dkim18Asked:
Who is Participating?
 
jaggernatConnect With a Mentor Commented:
>>> execute method inside of save/update method is a good idea?

you will not have a execute method inside save or update method.

your save or update methods are mapped to the names of the Buttons which you give in the jsp and that is why we use lookupdispatch action class.

0
 
jaggernatCommented:
use lookup dispatch action

http://husted.com/struts/tips/003.html
0
 
dkim18Author Commented:
That is not my intention here.  ;-) I am asking this to solve specific task.
Probably I can use javascript and java code inside of jsp, but I am looking for better way of doing this.
0
Get your problem seen by more experts

Be seen. Boost your question’s priority for more expert views and faster solutions

 
dkim18Author Commented:
Hm...calling execute method inside of save/update method is a good idea?
0
 
ManishConnect With a Mentor LeadCommented:
Change submit buttons to only button and on submit call javascript where you can pass hidden value for save or update and submit the form.
0
 
amateur83Connect With a Mentor Commented:
karanw is right. U may try something like below:

in JSP
------
<html-el:button property="Save" onclick="onSaveClick(this.form);"><bean:message key=""/>
</html-el:button>
<html-el:button property="Update" onclick="onUpdateClick(this.form);"><bean:message key=""/>
</html-el:button>

in JS
----
function onSaveClick(form)
{
      form.action = saveAction;
      form.submit();
}

function onUpdateClick(form)
{
      form.action = updateAction;
      form.submit();
}

and then back to the JSP that will forward to specific action
0
All Courses

From novice to tech pro — start learning today.