- struts-config.xml
<form-beans>
<form-bean name="editBUForm"
type="org.apache.struts.validator.DynaValidatorForm">
<form-property name="account" type="com.psca.M28000.bo.Account[]"/>
</form-bean>
</form-beans>
<action-mappings>
<action name="editBUForm" path="/EditBUOnLoadAction" scope="session"
type="com.psca.M28000.action.EditBUOnLoadAction" validate="false">
<forward name="ok" path="/frmEditBU.jsp"/>
</action>
<action name="editBUForm" path="/EditBUOnSubmitAction"
input="/frmEditBU.jsp" scope="session"
type="com.psca.M28000.action.EditBUOnSubmitAction" validate="true"/>
</action-mappings>
- EditBUOnLoadAction.java
DynaValidatorForm df = (DynaValidatorForm) form;
Set acc = bu.getAccounts();
Account[] account = new Account[acc.size()];
int i = 0;
for(Iterator ite = acc.iterator(); ite.hasNext(); i++) {
account[i] = (Account)ite.next();
}
df.set("account", account);
- jsp page
<logic:iterate id="account" name="editBUForm.map.Account">
<tr>
<td align="center" style="border-left:1px #8FA8CC solid">
<bean:write name="account" property="accCode" scope="page"/>
</td>
<td style="border-left:1px #8FA8CC solid; padding-left:2px">
<bean:write name="account" property="createdDt" scope="page"/>
</td>
</tr>
</logic:iterate>
When I run the jsp page, I receive error "Cannot find bean
editBUForm.map.Account in any scope"
Could you show me how to use logic:iterate to loop through Account[] of
form.
I saw an example using standard taglib to do that
<html:form action="/processActorComments" >
<table border="1" width="80%">
<tr><th>Last Name</th><th>First Name</th><th>Date of
Birth</th><th>Comment</th></tr>
<c:forEach var="people" items="${dynamicArrayForm.map.people}">
<tr><td><c:out value="${people.lastName}"/></td>
<td><c:out value="${people.firstName}"/></td>
<td><c:out value="${people.dateOfBirth}"/></td>
<td><html:text name="people" indexed="true"
property="comment"/></td>
</tr>
</c:forEach>
</table>
<P/>
<html:submit value="Update Comments"/>
</html:form>
But I am using servlet 2.2, so that I cannot use standard taglib.
Any help is much appreciated.
Regards,
Dang Minh Phuong
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]