Solved

Detecting button value

Posted on 2006-10-19
8
240 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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

Want Experts Exchange at your fingertips?

With Experts Exchange’s latest app release, you can now experience our most recent features, updates, and the same community interface while on-the-go. Download our latest app release at the Android or Apple stores today!

Question has a verified solution.

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

This article describes how to import Lotus Notes Contacts into Outlook 2016, 2013, 2010 and 2007 etc. with a few manual steps. You can easily export and migrate Lotus Notes contacts into Microsoft Outlook without having to use any third party tools.
First of all let me say that the only language that I speak is English, but in answering questions here I often come across people whose English skills are not the best and I’d like to be able to communicate better with them, and the following descr…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Monitoring a network: why having a policy is the best policy? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the enormous benefits of having a policy-based approach when monitoring medium and large networks. Software utilized in this v…

615 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