Solved

Detecting button value

Posted on 2006-10-19
8
233 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
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

In this article, I will show you HOW TO: Suppress Configuration Issues and Warnings Alert displayed in Summary status for ESXi 6.5 after enabling SSH or ESXi Shell.
In this article, I show you step by step with screenshots to assist you - HOW TO: Deploy and Install the VMware vCenter Server Appliance 6.5 (VCSA 6.5), with some helpful tips along the way.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

747 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

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now