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/09 09:29:53 UTC

Iterate an indexed property, again?

Hi,
I already did this.
The same code works perfectly when I hardcode like this:
<html:text property="routingData[0].timeOfDayStart" size="6"/></<td
class="input">
<html:text property="routingData[1].timeOfDayStart" size="6"/></<td
class="input">
<html:text property="routingData[2].timeOfDayStart" size="6"/></<td
class="input">'
but I want use an int to iterate instaed hardcode on the jsp page.

Somebody help me,
Katarina

  -----Original Message-----
  From: Hatinder Chawla [mailto:hchawla@svbank.com]
  Sent: den 9 mars 2001 00:43
  To: 'struts-user@jakarta.apache.org'
  Subject: RE: Iterate an indexed property?


  I got a similar problem and resolved it by adding indexed accessors to the
bean. Add methods like getRoutingData(int index) and setRoutingData(int
index, RoutinData data).


  Hatinder
    -----Original Message-----
    From: Katarina Nelson [mailto:katarina@appium.com]
    Sent: Thursday, March 08, 2001 10:29 AM
    To: Struts-User
    Subject: 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






****************************************************************************
*******
  We invite you to sign up for eSource, our portal for entrepreneurs
providing access to content and services from national service providers who
are proven resources to the entrepreneurial community. Click on
http://esource.svb.com to register for service at no charge. We would be
delighted to receive your feedback.

****************************************************************************
*******
  This message contains information from Silicon Valley Bank which may be
confidential and privileged. If you are not an intended recipient, please
refrain from any disclosure, copying, distribution or use of this
information and note that such actions are prohibited. If you have received
this transmission in error, please notify the sender immediately by
telephone or by replying to this transmission.

****************************************************************************
*******