You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Ashish Kulkarni <ku...@yahoo.com> on 2002/08/29 16:31:34 UTC
Struts and Many Buttons on Single page
Hi,
I am developing a struts applicatian, I have a jsp page where i have 5 buttons, say Add, Change,Delete, Display.
When i click these buttons they must call different jsp with different parameters, how can i do it???
Ashish
A$HI$H
---------------------------------
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes
Re: Struts and Many Buttons on Single page
Posted by Renato Aganippe <ra...@cardiweb.com>.
Hi,
I see two solution for this.
1) For each button, you can define a different form with a different action
attribute
2) You can use a javascript function to change the action attribute
Ex:
<script language=JavaScript>
function doSubmit(val) {
if (val==1) {
document.forms.consult.action='/save.do';
}
else if (val==2) {
document.forms.consult.action='/remove.do';
}
document.forms.consult.submit();
}
</script>
<html:form name="consult" type="ActionForm" action="/save.do">
<input type=button class=simpletext value=Valider
onClick="doSubmit(1);return false;">
<input type=button value="Delete" class="simpletext" onClick="if
(confirm('Etes vous certain de vouloir supprimer cet enregistrement ?'))
doSubmit(2); return false;">
</html:form>
Hope it will help,
Renato
----- Original Message -----
From: "Ashish Kulkarni" <ku...@yahoo.com>
To: "Struts Users Mailing List" <st...@jakarta.apache.org>
Sent: Thursday, August 29, 2002 4:31 PM
Subject: Struts and Many Buttons on Single page
>
> Hi,
>
> I am developing a struts applicatian, I have a jsp page where i have 5
buttons, say Add, Change,Delete, Display.
>
> When i click these buttons they must call different jsp with different
parameters, how can i do it???
>
> Ashish
>
>
> A$HI$H
>
>
> ---------------------------------
> Do You Yahoo!?
> Yahoo! Finance - Get real-time stock quotes
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
RE: Struts and Many Buttons on Single page
Posted by "C.Bhaskaran" <ch...@wipro.com>.
In your action class use
Depending on the name of button or id
If(request.getParameter("add") != null)
{
actionMapping.findForword("add");
}
Else if (request.getParameter("delete") != null)
{
actionMapping.findForword("delete");
}
In struts config.xml file
In global forword section
For add say /examples/add.do (Go to the add action class)
For delete say /examples/delete.do (Go to the delete action class)
Rgds
C.Bhaskaran
-----Original Message-----
From: Ashish Kulkarni [mailto:kulkarni_ash1312@yahoo.com]
Sent: Thursday, August 29, 2002 8:02 PM
To: Struts Users Mailing List
Subject: Struts and Many Buttons on Single page
Hi,
I am developing a struts applicatian, I have a jsp page where i have 5
buttons, say Add, Change,Delete, Display.
When i click these buttons they must call different jsp with different
parameters, how can i do it???
Ashish
A$HI$H
---------------------------------
Do You Yahoo!?
Yahoo! Finance - Get real-time stock quotes
Re: Struts and Many Buttons on Single page
Posted by adam kramer <ad...@monkey.org>.
Ashish,
Try checking out husted.com struts tips and catalog:
Struts Tip #2 - Use DispatchAction to organize related operations
http://husted.com/struts/tips/002.htm
Struts Tip #3 - Use LookupDispatchAction for a JavaScript-free dispatch
http://husted.com/struts/tips/003.htm
and Use multifunction Actions to service related ActionMappings
in http://husted.com/struts/catalog.htm
Adam K.
On Thu, 29 Aug 2002, Ashish Kulkarni wrote:
>
> Hi,
>
> I am developing a struts applicatian, I have a jsp page where i have 5 buttons, say Add, Change,Delete, Display.
>
> When i click these buttons they must call different jsp with different parameters, how can i do it???
>
> Ashish
>
>
> A$HI$H
>
>
> ---------------------------------
> Do You Yahoo!?
> Yahoo! Finance - Get real-time stock quotes
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>