struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Piotr Falenczyk <p...@o2.pl>
Subject Struts2, collection of objects and JSP
Date Thu, 07 Feb 2008 11:32:39 GMT

Hello

I have a following problem

I have an action defined, let's say:

public class SomeAction extends ActionSupport implements SessionAware{

private Map sessionMap;

        @Override
	public String execute() throws Exception {

		return SUCCESS;
	}

        public void setSession(Map map) {
		this.sessionMap = map;
	}

	public long getSideId() {
		return sideId;
	}

	public List<Import> getImports() {
		return (List<Import>)sessionMap.get("imports");
	}
	
	public void setImports(List<Import> imports) {
		sessionMap.set("imports", imports);
	}

}

The Import class is a simple POJO

public class Import extends Serialicable {

private String name;

        public String getName() {
		return name;
	}
	
	public void setName(String name) {
		this.name = name;
	}

}


I need to display all the names of Imports, and allow to edit every one of
them in one page. What I do now is somethin like that ion JSP. Displaying
values work just fine, but I canno't change them (not stored back in the
session)


<s:iterator value="imports">

<s:textfield name="name" /> </br>

<s:iterator/>


What I know is that I need to set for name of every textfield
"imports[index_in_list].name" in order to make it work, but how can I do it?

Thanks for help in advance

Piotr Falenczyk
-- 
View this message in context: http://www.nabble.com/Struts2%2C-collection-of-objects-and-JSP-tp15331960p15331960.html
Sent from the Struts - User mailing list archive at Nabble.com.


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message