You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Oleg V Alexeev <go...@penza.net> on 2000/09/24 19:38:04 UTC

indexed properties

Hello struts-user,

 Can I use indexed properties in input forms for ActionServlet? In my
 work I try to use indexed properties, but struts engine not process
 it. Is it my code bug or struts'?
 
 JSP:
  <struts:text
    name="myForm"
    property="<%=myForm.getIndexedName()%>"
    value="<%=myForm.getValue()%>"
    />
    
 java:
 ...
 public String getIndexedName() {
  return "propName[" + Integer.toString(id) + "]";
 }

 public String getPropName( int index ) {
  return s.get(new Integer(index));
 }

 public void setPropName( int index, String value ) {
  s.put( new Integer(index), value );
 }
 ...

 When I use <bean:write tag to show indexed value of property then all
 right. When I use in struts:text tag name for indexed property
 without value:
  <struts:text
    name="myForm"
    property="%=myForm.getIndexedName()%>"
    />
 then I get a error - not found property propName[1]. When I use value
 in struts:text tag then all right. But when I submit my values then
 old values are passed to action class because of non of indexed
 properties setters methods are called to pass values from HTTP
 request. May be my code wrong? Or struts can not do it?
 
 Please answer to question - I am so lazy to code additional form for
 indexed properties processing.. 8)

-- 
Best regards,
 Oleg                          mailto:gonza@penza.net