You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by deepank <de...@sasken.com> on 2002/09/25 06:40:22 UTC

indexed attribute for html tags

I would like to use indexed attribute for some html tags to handle dynamic html input elements (the number of input elements in the form is not fixed)

i have read the struts user guide, but unable understand what this means. This is given for almost all html input tags

 indexed  -  Valid only inside of logic:iterate tag. If true then name of the html tag will be rendered as "id[34].propertyName". Number in brackets will be generated for every iteration and taken from ancestor logic:iterate tag. (RT EXPR) 

"WHAT DOES "id[34].propertyName" MEAN????

can somebody give me an example how to use this attribute. how will the property of a form bean and its corresponding getter/setter method look like if i want to use the indexed attribute.

for example i have this in my jsp

<logic:iterate id="reviewer" name="revFormTeamVO" property="reviewers" >
    <html:text indexed="true" property="mail_id_v" size="10" value="/></TD>
</logic:iterate>

i have the form bean property mail_id_v declared as

private String[] mail_id_v;

public String getMail_id_v(int index) {
      return this.mail_id_v[index];
  }

 public void setMail_id_v(int index, String mail_id_v) {
    this.mail_id_v[index] = mail_id_v;
 }
    
But this does not work, i get an error, "No getter method for property "mail_id_v"

any help will be appreciated

Deepank