You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Corey Klaasmeyer <Co...@klaasmeyer.com> on 2002/09/20 16:21:11 UTC

[Indexed Property][DynaActionForm] Why am I Receiving "No indexed value for 'progress[0]'" Error?

Version: Nightly Build 20020729

Config, JSP, and code which throws the exception are included below. I am
attempting to use indexed properties with DynaActionForm, and receiving an
error along the way: "No indexed value for 'progress[0]'". The property
"progress" is defined in the config file as an indexed property, and the
error message indicates that the property name and index are passed into the
DynaActionForm properly. Why then, would getDynaProperty() return null in
this case? 

Am I defining this correctly in the config and JSP files? If not, what needs
to be changed? Finally, is there an easier way of implementing this? 

Thanks,
Corey

------------------------------------------------------

In struts-config.xml:

  <form-bean name="progressForm" dynamic="true"
             type="org.apache.struts.action.DynaActionForm">
    ...
    <form-property name="progress" type="java.lang.String[]"/>
    ...
  </form-bean>

In progress-form.jsp:

  <html:form action="/progress" focus="submit">
    ...
    <logic:iterate name="phases" id="phase" indexId="index">
      ...
      <%
        String property = "progress[" + pageContext.getAttribute("index") +
"]";
        pageContext.setAttribute("property", property);
      %>
      <html:text property="<%=property%>" size="20"/>
      ...
    </logic:iterate>
  </html:form>

Error:

No indexed value for 'progress[0]'

Code that throws error:
  ...
  DynaProperty descriptor = getDynaProperty(name);
  Object value = dynaValues.get(name);
  if (value == null) {
    throw new NullPointerException
      ("No indexed value for '" + name + "[" + index + "]'");
  ...

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>