A bit more info

Matt Hargus <[email protected]> Thu, 28 Dec 2006 13:30:27 CST
Newsgroups gmane.comp.java.open-symphony.webwork
Message-ID <7647143.1167334281187.JavaMail.os-j2ee@opensymphony01.managed.contegix.com>
I thought I'd add a little bit more to the puzzle here.

This is what my action looks like:

[code]
public class PersonAction extends ActionSupport implements Preparable {

	Person person;
	Dao dao;
	List<Car> carList;

	public void setDao(Dao dao){
		this.dao = dao;
	}

	public Person getPerson() {
		return person;
	}

	public void setPerson(Person person) {
		this.person = person;
	}

	public List<Cars> getCarList(){
		return this.carList;
	}

	public String execute(){
		dao.save(this.person);
		
		return Action.SUCCESS;
	}

	public void prepare() throws Exception {
		carList = (List<Car>) dao.findAll(Car.class);

	}

}
[/code]

And here's a snippet from my JSP page:

[code]
<ww:form action="person.action">
	<ww:textfield name="person.name" label="Name"/>
	<ww:select name="person.favoriteCar"
			   list="carList"
			   listKey="id"
			   listValue="model"
			   headerKey="''"
			   headerValue="Select a favorite car"/>
	<ww:submit value="Submit" />
</ww:form>
[/code]

I hope this sheds some more light on the situation
---------------------------------------------------------------------
Posted via Jive Forums
http://forums.opensymphony.com/thread.jspa?threadID=55649&messageID=110879#110879