Careful with this.... you're tying your View with your Controller by way of
the button text.  If  your button text changes, so will your Action code.  A
better solution in the case where the button name is the same for all
buttons is to use a solution I proposed on struts-dev recently:

    http://marc.theaimsgroup.com/?l=struts-dev&m=100577282829753&w=2

The code posted will work as-is - I just want to split it up some more.

    Erik


----- Original Message -----
From: "emmanuel.boudrant" <[EMAIL PROTECTED]>
To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
Sent: Tuesday, November 20, 2001 10:20 AM
Subject: Re: which button pressed?


>
>  Hi,
>
> I suggest you to use : <html:submit property="propertyname"
value="buttonname"/>
> ex:
> <html:submit property="myAction" value="add"/>
> <html:submit property="myAction" value="del"/>
> and in Action class, to determine witch button is pressed:
> String button = request.getParameter("myAction");
> if ( button.equals("add") ) { ... }
>
> But I don't know if <html:submit property="propertyname"
value="</bean:message ... />"/> work ?
>   Māris Orbidāns <[EMAIL PROTECTED]> a écrit :
> Hello all
>
> I have several submit buttons like this:
>
>
>
>
> key="button.prev"/>
> key="button.next"/>
> key="button.save"/>
> key="button.delete"/>
> key="button.add"/>
>
>
>
> The question is: How to determine which one has been pressed ?
>
>
> Maris Orbidans
>
>
>
> --
> To unsubscribe, e-mail:
> For additional commands, e-mail:
>
>
>
> ---------------------------------
> Yahoo! Courrier -- Une adresse @yahoo.fr gratuite et en franįais !
>


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

Reply via email to