struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Siggelkow, Bill" <bill.siggel...@mirant.com>
Subject RE: indexed property iteration
Date Tue, 17 Jul 2001 13:13:05 GMT
What you *really* should do is use the Struts "iterate" tag in the logic
TLD. 
Using scriptlet is generally a *bad* thing ... however, if you really wanted
to do this you need to use a JSP expression for the property value like this
...
   Text: <html:text property='<%=names[i]%>'/>


-----Original Message-----
From: Ramakrishna Reddy Kandula [mailto:rkandula@cisco.com]
Sent: Monday, July 16, 2001 9:36 PM
To: struts-user@jakarta.apache.org
Subject: indexed property iteration



How do I achieve indexed property access dynamically ?

The following doesn't work.

<html:form name='testForm' type='test.TestForm' action='test.do'>
<%
   TestForm testForm = (TestForm) session.getAttribute("testForm");
   int i = 0;
   for (i=0; i < testForm.getNames().length; i++) {
%>
   Text: <html:text property='names[i]'/>
<%
   }
%>
   <html:submit>Go</html:submit>
</html:form>

It says,
javax.servlet.ServletException: Invalid indexed property 'names[i]'

Thanks,
ramky

Mime
View raw message