You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by xnpeng <xn...@163.com> on 2009/03/19 16:34:39 UTC

struts2 iterator list mapping --ReST

in struts2-REST environment,i cannot run struts2/showcase/person example.
 
in struts2/showcase/person,there is a <s:iterator>:
<s:form action="person/person" theme="simple" method="post" validate="false">
    <table>
        <tr>
            <th>ID</th>
            <th>First Name</th>
            <th>Last Name</th>
        </tr>
        <s:iterator var="p" value="persons">
            <tr>
                <td>
                    <s:property value="%{id}"/>
                </td>
                <td>
                    <s:textfield label="First Name" 
                       name="persons(%{id}).name" 
                       value="%{name}" theme="simple"/>
                </td>
                <td>
                    <s:textfield label="Last Name" 
                       name="persons(%{id}).lastName" 
                       value="%{lastName}" theme="simple"/>
                </td>
            </tr>
        </s:iterator>
    </table>
    <s:submit method="update" value="Save all persons"/>
</s:form>

the action.update:
    public HttpHeaders update() {
        System.out.println("=======update");
        for (Person p : persons) {
            personManager.getPeople().remove(p);
            personManager.getPeople().add(p);
        }
        return new DefaultHttpHeaders("index");
    }
 
when i submit the form,there is lots of exceptions for each input field:
ognl.OgnlException: Error getting property descriptor: null
just before ("=======update");
seems to have no value transfer to action variable: List person. 
 
how to manage this?
thanks