Wednesday, April 15, 2009

Bind a list to HTML select with Spring

Let's say you have a list of objects that you want to bind as HTML SELECT in JSP. You need to populate the list with data in referenceData(). Note it has to be a list of objects with getters and setters for properties (or Spring PropertyValue object). Next you can add the following code in JSP.



"aProperty" here is the name of the property in the command object that you want to bind the selected option to.

No comments:

Post a Comment