hi. im trying to make a dynamic form(request time) using list-backed property, following the struts user guide
http://struts.apache.org/userGuide/b...n_form_classes
public FooForm extends ActionForm {
private final List values = new ArrayList();
public void setValue(int key, Object value) {
values.set(key, value);
}
public Object getValue(int key) {
return values.get(key);
}
}
however, im not sure of what they mean by:
"In your presentation pages, you access individual entries in a list-backed property by using a different special notation: listname[index]. The braces in the bean property name indicate that the bean property named listname is indexed (probably backed by a List), and that Struts should look for get/set methods that take an index parameter in order to find the correct sub-property value."
how can i access the property? heres my jsp:
<%@ taglib uri="/tags/struts-html" prefix="html" %>
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<%@page isELIgnored = "false" %>
<html>
<body>
<html:form action="/indextest">
<c:forEach begin="0" end="2" var="cnt">
<html:text property="listname[${cnt}]"/>
<br/>
</c:forEach>
<html:submit>Submit</html:submit>
</html:form>
</body>
</html>
any help appreciated...


Reply With Quote
Bookmarks