Solved

Detecting button value

Posted on 2006-10-19
8
239 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 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 84 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 83 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 83 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

[Webinar] Code, Load, and Grow

Managing multiple websites, servers, applications, and security on a daily basis? Join us for a webinar on May 25th to learn how to simplify administration and management of virtual hosts for IT admins, create a secure environment, and deploy code more effectively and frequently.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Jquery - parsing the results returned from webmethod 1 128
attribute vs parameter and setter vs add method 17 97
spring AOP 6 94
runtime exception and error differences 4 95
Deploying our service is a grudge match between customer benefits and customer pain. In one corner, rolling out fixes (yay!) and delivering new features (double yay!). In the other corner, training on new features (boo – sounds like work), and chan…
The goal of this blog is to: > note what has impeded us from reaching effective life on-call > provide 3 steps to mastering life on-call > highlight what will be achieved with effective life on-call
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

752 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