If the multiple buttons are part of the same form, then give them different names. 
When the form submits you will see a name/value pair "submit=buttonname". Get this 
value out of the request, then use the value to take your processing in the right 
direction.

For development, set your form method=GET. Then you will see these values in the URL.



-----Original Message-----
From: Renato Aganippe [mailto:[EMAIL PROTECTED]]
Sent: Thursday, August 29, 2002 10:22 AM
To: Struts Users Mailing List
Subject: Re: Struts and Many Buttons on Single page


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" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
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:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to