java - Loop Through List of Objects in JSP and Submit One of Them -


i have list of products, , want iterate through each in jsp, , have user choose one. once chosen, want submit 1 individual product object model attribute, spring controller.

basically, want this. getting 400 error. attempting possible?

        <form:form method="post" modelattribute="listproduct">             <c:foreach items="${listproduct}" var="prd">                 <tr >                     <td><c:out value="${prd.description}"/></td>                     <td><c:out value="${prd.productid}"/></td>                     <td><form:input type="hidden" path="prd" readonly="true"/></td>                     <td><input type="submit" value="select" /></td>                 </tr>             </c:foreach>         </form:form> 

if using struts2 form variable iterate of type list , try this:

<form:form method="post" modelattribute="listproduct">             <s:iterator value="">                <tr>                   <td><s:property value="value.description" />                   <td><s:property value="value.productid" />                </tr>             </s:iterator>         </form:form> 

Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -