Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Detecting button value

Posted on 2006-10-19
8
Medium Priority
?
247 Views
Last Modified: 2010-04-01
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,
0
Comment
Question by:dkim18
6 Comments
 
LVL 10

Expert Comment

by:jaggernat
ID: 17770012
use lookup dispatch action

http://husted.com/struts/tips/003.html
0
 

Author Comment

by:dkim18
ID: 17770108
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
 

Author Comment

by:dkim18
ID: 17770136
Hm...calling execute method inside of save/update method is a good idea?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 10

Accepted Solution

by:
jaggernat earned 336 total points
ID: 17770445
>>> 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
 
LVL 11

Assisted Solution

by:Manish
Manish earned 332 total points
ID: 17794103
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
 
LVL 2

Assisted Solution

by:amateur83
amateur83 earned 332 total points
ID: 17855279
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

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Microsoft Access has a limit of 255 columns in a single table; SQL Server allows tables with over 255 columns, but reading that data is not necessarily simple.  The final solution for this task involved creating a custom text parser and then reading…
In this article, the configuration steps in Zabbix to monitor devices via SNMP will be discussed with some real examples on Cisco Router/Switch, Catalyst Switch, NAS Synology device.
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Are you ready to place your question in front of subject-matter experts for more timely responses? With the release of Priority Question, Premium Members, Team Accounts and Qualified Experts can now identify the emergent level of their issue, signal…

824 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question