You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by "Rea, Ron" <re...@coramhc.com> on 2002/09/27 20:35:47 UTC

Iterate tag question

I am trying to iterate through several array fields on my Form within the
JSP, display the properties as a table on the page.  Using arrays should
allow me to update the table data, however I cannot seem to get the iterate
tag to work.  The following is an example of what I'm doing.  Any ideas on
how this iterate tag should look - I'm just trying to go through the array,
held in the ActionForm,  and display each occurance as a row in the JSP.
 
ResponseProcessForm:
 
            public void setMsgCode(String[] msgCode) {
                        this.msgCode = msgCode;
            }
 
            public String[] getMsgCode() {
                        return msgCode;
            }
 
            public void setMsgDesc(String[] msgDesc) {
                        this.msgDesc = msgDesc;
            }
 
            public String[] getMsgDesc() {
                        return msgDesc;
            }
 
section of JSP:
 
            <logic:iterate id="grid"
                         name="responseProcessForm"
property="msgCode">
                        <td> <bean:write name="grid" property="msgCode"
filter="true"/> &nbsp;</td>
                        <td><html:text property="msgDesc" size="6"
maxlength="6" />&nbsp;</td>
            </logic:iterate>
 
Using this code gives me this error: javax.servlet.ServletException: No
getter method for property msgCode of bean grid
 
Thanks!

Re: Iterate tag question

Posted by John Owen <jo...@hotmail.com>.
String[] is just an array of String. It has no iterator. You need a
Collection, List or Enumeration.

----- Original Message -----
From: "Rea, Ron" <re...@coramhc.com>
To: <st...@jakarta.apache.org>
Sent: Friday, September 27, 2002 1:35 PM
Subject: Iterate tag question


> I am trying to iterate through several array fields on my Form within the
> JSP, display the properties as a table on the page.  Using arrays should
> allow me to update the table data, however I cannot seem to get the
iterate
> tag to work.  The following is an example of what I'm doing.  Any ideas on
> how this iterate tag should look - I'm just trying to go through the
array,
> held in the ActionForm,  and display each occurance as a row in the JSP.
>
> ResponseProcessForm:
>
>             public void setMsgCode(String[] msgCode) {
>                         this.msgCode = msgCode;
>             }
>
>             public String[] getMsgCode() {
>                         return msgCode;
>             }
>
>             public void setMsgDesc(String[] msgDesc) {
>                         this.msgDesc = msgDesc;
>             }
>
>             public String[] getMsgDesc() {
>                         return msgDesc;
>             }
>
> section of JSP:
>
>             <logic:iterate id="grid"
>                          name="responseProcessForm"
> property="msgCode">
>                         <td> <bean:write name="grid" property="msgCode"
> filter="true"/> &nbsp;</td>
>                         <td><html:text property="msgDesc" size="6"
> maxlength="6" />&nbsp;</td>
>             </logic:iterate>
>
> Using this code gives me this error: javax.servlet.ServletException: No
> getter method for property msgCode of bean grid
>
> Thanks!
>

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>