Hi, we have defined the following custom object:
public class GenericElement{ private String key; private String value; public GenericElement(){ } public String getKey() { return key; } public void setKey(String key) { this.key = key; } public String getValue() { return value; } public void setValue(String value) { this.value = value; } } And the following action class that uses a HashMap of such objects: public class CommunicationSettingsAction extends ActionSupport { private Map list; public String save() throws Exception { //here should be populated } public String load() throws Exception{ this.list = new HashMap(); GenericElement ge = new GenericElement(); ge.setKey("key one"); ge.setValue("one value"); this.list.put("one", ge); ge = new GenericElement(); ge.setKey("two"); ge.setValue("two value"); this.list.put("two", ge); return SUCCESS; } public Map getList() { return list; } public void setList(Map list) { this.list = list; } } Finally, the JSP looks like this: <%@ taglib prefix="s" uri="/struts-tags" %> <%@ include file="/includes/body_header.jsp" %> /images/customer_l.gif Now the action executes fine and we get back a list with one object in it. So that is OK. However the key is always set to null so when we have multiple objects on the page (i.e. multiple sets of textboxes ) on submit we only get back the last object since at every step it is over written because the key is not set. What needs to be done to have the key for each object in the hash map be set back as well. We have seen cases where this was done with Struts 2 by hard coding the key but how can one do it dynamically ? Thanks -- View this message in context: http://www.nabble.com/How-to-write-JSP-to-populate-back-a-hashmap-of-custom-objects-tp14665986p14665986.html Sent from the Struts - User mailing list archive at Nabble.com.