struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Konstantina Stamopoulou" <s...@intracom.gr>
Subject Re: html:submit button
Date Fri, 22 Feb 2002 07:55:38 GMT
Thank U for your reply and for the code details!
I used this approach to see which button was pressed and the <html: hidden>
tag  to pass the product id.

Thank U all for your help!
Konstantina

----- Original Message -----
From: "Maturo, Larry" <larry_maturo@athensgroup.com>
To: "'Struts Users Mailing List'" <struts-user@jakarta.apache.org>
Sent: Thursday, February 21, 2002 5:30 PM
Subject: RE: html:submit button


> Hi Konstantina,
>
> Since you haven't supplied enough details, I'll assume that
> you have a table, and each row contains info on one product,
> plus two buttons, one for displaying info and one for do
> something with the product.
>
> In this case you then make each button look like an array, in
> your form bean, declare something like:
>
>     private int editIndex = -1;
>     private int infoIndex = -1;
>     private String editString = "";
>     private String infoString = "";
>
>     public String getEditString(int index) {
>         return editString;
>     }
>
>     public final void setEditString(int index, String editString){
>         this.editString = editString;
>         this.editIndex = index;
>     }
>
>    public int getEditIndex () {
>         return editIndex;
>    }
>
>     public String getInfoString(int index) {
>         return infoString;
>     }
>
>    public final void setInfoString(int index, String infoString){
>         this.infoString = infoString;
>         this.infoIndex = index;
>    }
>
>    public int getInfoIndex() {
>        return infoIndex;
>    }
>
> In your jsp, inside your iterate, you woud use:
>
> <html:submit indexed="true" property="editCmd" value="Edit" />
> <html:submit indexed="true" property="infoCmd" value="Info" />
>
> When submitted you can use getInfoString and getEditString
> to see which button was pressed (the pressed button will have
> a value other than "") and then use the appropriate get index
> to see which item was selected.
>
> -- Larry Maturo
>    lmaturo@athensgroup.com
>
>
> -----Original Message-----
> From: Konstantina Stamopoulou [mailto:stak@intracom.gr]
> Sent: Thursday, February 21, 2002 4:02 AM
> To: Struts Users Mailing List
> 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:struts-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
<mailto:struts-user-help@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <mailto:struts-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:struts-user-help@jakarta.apache.org>


Mime
View raw message