On your jsp

<html:submit property="X"  value="X"/>
<html:submit property="Y"  value="Y"/>

On Action Page
String button1=request.getParameter("X");
String button1=request.getParameter("Y");

if(button1 != null){
//X was clicked
//do whatever like forward to another actionpage
}
else if(button2 != null){
//Y was clicked
//do whatever like forward to another actionpage
}

else
{
//neither was clicked
}
>From: "Konstantina Stamopoulou" <[EMAIL PROTECTED]>
>Reply-To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
>To: "Struts Users Mailing List" <[EMAIL PROTECTED]>,   "rob" 
><[EMAIL PROTECTED]>
>Subject: Re: html:submit button
>Date: Thu, 21 Feb 2002 13:23:27 +0200
>
>Hi  Rob,
>
>I tried this solution but the thing is that the "value" is set as the label
>of the button. Isn't there a more elegant way to do this? As far as the
>radio buttons concerned, my submit buttons do not apply only to the name of
>product but to some other configuration parameters too. So I have 10 lines
>of config parameters and two buttons under these.
>
>Thank you for your instant reply,
>Konstantina
>
>----- Original Message -----
>From: "rob" <[EMAIL PROTECTED]>
>To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
>Sent: Thursday, February 21, 2002 12:32 PM
>Subject: Re: html:submit button
>
>
> > You can setup a property in your form bean to receive the value of the
> > button and just pack the button value with the product id (since if I
> > understand correctly you have a button for every product entry)
> >
> > ie. <html:submit property="button" value="view produc list:productid"/>
> > and <html:submit property="button" value="do something else:productid"/>
> >
> > in your action you can retrieve the property and compare it.
> >
> > if (form.getButton().startsWith("view product list")) {
> >     String value = form.getButton();
> >     tokenize out the id with StringTokenizer or something.
> >        .. do the view product list stuff ...;
> > }
> > if (form.getButton().equals("do something else")) {
> >     same as above just do the something else
> > }
> >
> > If I understand correctly the above is one solution although I might
>suggest
> > using a radio button(s) for product selection and then only one pair of
> > buttons.
> >
> >
> > ----- Original Message -----
> > From: "Konstantina Stamopoulou" <[EMAIL PROTECTED]>
> > To: "Struts Users Mailing List" <[EMAIL PROTECTED]>
> > Sent: Thursday, February 21, 2002 9:02 PM
> > Subject: html:submit button
> >
> >
> > Hello,
> > I have a problem and I can't fingure out the solution to it. Here is my
> > case:
> >
> > I have a list of products (PoductBean) on my .jsp and each one of it 
>have
> > two buttons (html:submit)  :
> >
> > Button1 --> Display Information for this product
> > Button2 --> Use the information to do something else
> >
> > My question is: How can I decide which product has been selected so as 
>to
> > display its information on my next page?
> > From what I have seen the html:submit tag does not contain any 
>attributes
>to
> > pass request parameters.
> >
> > Thank U in advance,
> > Konstantina
> >
> >
> >
> >
> >
> >
> >
> >
> > --
> > 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]>
>




_________________________________________________________________
Join the world’s largest e-mail service with MSN Hotmail. 
http://www.hotmail.com


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

Reply via email to