struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Philipp Leusmann <philipp.leusm...@rwth-aachen.de>
Subject Problem with value attribute in select tag
Date Fri, 18 Dec 2009 15:30:33 GMT
Hi,

what exactly does the value-attribute of the select tag require? Is it one element of the
list provided to the list-argument? Or is it the value which eventually makes the value-attribute
of the html-rendered select tag?

I have something like the following and I do not find a way to work as expected:

public class SelectAction extends ActionSupport
{
	private List<TestObject> list = new ArrayList();

	private TestObject object;

	public String execute()
	{	
		TestObject to1 = new TestObject(1, "foo");
		list.add(to1);
		TestObject to2 = new TestObject(2, "bar");
		list.add(to2);
		object = to2;
	}

	[getters for the stuff above]

}

public class TestObject 
{
	private Integer id;

	private String str;

	public TestObject(Integer id, String str)
	{
		this.id = id;
		this.str = str;
	}

	[getters]
}



And in the template (using Freemarker) I tried:

	<@s.select name="bla" list=list listKey="id" listValue="str" value=object />

	<@s.select name="bla" list=list listKey="id" listValue="str" value=object.id />

	<@s.select name="bla" list=list listKey="id" listValue="str" value="${object.id}" />

	<@s.select name="bla" list=list listKey="id" listValue="str" value=${object} />

None of the above worked.


Could anybody please tell me what the correct value-argument would be?

Thanks very much,

 Philipp



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


Mime
View raw message