You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Katarina Nelson <ka...@appium.com> on 2001/03/08 19:29:01 UTC
Iterate an indexed property?
Hi,
I try on my jsp page iterate an indexed property.
I get this exception:
"javax.servlet.ServletException: Invalid indexed property 'routingData[]'"
My code:
<%
int counter = 0;
String s = null
s.valueOf(counter);
for (int i = 0; i < myRoutingList.getRouteElements().size(); i++) {
%>
<tr>
<td class="input">
<html:text property="routingData[<%=s%>].timeOfDayStart" size="6"/></<td
class="input">
<html:text property="routingData[<%=s%>].timeOfDayStop" size="6"/>
</td>
</tr>
<%
counter++;
s = s.valueOf(counter);
}
%>
I tried both with counter as an int and a string . No one seems work.
Do somebody know what´s is the problem?
Thanks,
Katarina
Re: Iterate an indexed property?
Posted by Elod Horvath <el...@itfais.com>.
> Katarina Nelson wrote:
>
> Hi,
>
> I try on my jsp page iterate an indexed property.
> I get this exception:
> "javax.servlet.ServletException: Invalid indexed property
> 'routingData[<%=s%>]'"
>
> My code:
> <%
> int counter = 0;
> String s = null
> s.valueOf(counter);
> for (int i = 0; i < myRoutingList.getRouteElements().size(); i++) {
> %>
>
> <tr>
> <td class="input">
> <html:text property="routingData[<%=s%>].timeOfDayStart"
> size="6"/></<td class="input">
> <html:text property="routingData[<%=s%>].timeOfDayStop" size="6"/>
> </td>
> </tr>
> <%
> counter++;
> s = s.valueOf(counter);
> }
> %>
>
> I tried both with counter as an int and a string . No one seems work.
> Do somebody know what´s is the problem?
>
> Thanks,
> Katarina
>
>
> <%=s%>
>
jsp RTE expressions are an all or nothing gig when specifying
attribute values for a tag, so the following is illegal:
<html:text property="routingData[<%=s%>].timeOfDayStart" size="6"/>
try this instead:
<html:text property='<%="routingData["+s+"].timeOfDayStart" %>' size="6"/>
(NOTE the single quotes around the RTE to prevent the JSP parser from
getting terminall confused by the embedded double quotes within the
RTE)
hope that helps,
e
--
_______________________________________________________________________
Elod Horvath ('e') / ITFAIS Records (http://www.itfais.com/)