I've created a page using indexed tags (neat stuff!).
Here is what is currently working for me:
o If i populate the form's vector, values from that vector are displayed in
the jsp
Here is what it not working:
o when the form is posted back, the vector is null (in the struts perform()
method)
I suspect i haven't implemented some sort of setter within the form but i
can't find an example as to what method should be implemented. I've tried
ArrayList and using parameterList instead with no different result.
Thanks,
Waz.
=)
Here are some code snippits for help:
---jsp---
<logic:iterate id="mappings" name="FieldsMapForm" property="fieldMappings">
<html:text name="mappings" property="attributeCode" indexed="true"/> <br>
</logic:iterate>
---Form---
public class FieldsMapForm extends ActionForm {
private String fileColCount;
private java.util.Vector fieldMappings = new java.util.Vector();
private String action;
public String getFileColCount() {
return fileColCount;
}
public void setFileColCount(String newFileColCount) {
fileColCount = newFileColCount;
}
public void setFieldMappings(java.util.Vector newFieldMappings) {
fieldMappings = newFieldMappings;
}
public java.util.Vector getFieldMappings() {
return fieldMappings;
}
public FieldMapping getParameter(int index) {
return (FieldMapping)fieldMappings.elementAt(index);
}
public void setAction(String newAction) {
action = newAction;
}
public String getAction() {
return action;
}
public void reset(ActionMapping mapping, HttpServletRequest request) {
fileColCount = null;
fieldMappings = new java.util.Vector();
action = null;
}
}
---The vector contains these:---
public class FieldMapping implements Serializable {
private Integer fieldNumber;
private String attributeCode;
public void setFieldNumber(Integer newFieldNumber) {
fieldNumber = newFieldNumber;
}
public Integer getFieldNumber() {
return fieldNumber;
}
public void setAttributeCode(String newAttributeCode) {
attributeCode = newAttributeCode;
}
public String getAttributeCode() {
return attributeCode;
}
}