Skip to content

Instantly share code, notes, and snippets.

@juanfezero
Last active November 19, 2015 19:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save juanfezero/0fab975dbd2f55b0e02b to your computer and use it in GitHub Desktop.
Save juanfezero/0fab975dbd2f55b0e02b to your computer and use it in GitHub Desktop.
spring select options with enum - juanfezero -
<!--
Enum example:
public enum Foo {
A("theA"), B("theB");
private String code;
private Foo(String code) {
this.code = code
}
//getter & setter's code
}
// in a controller method
model.addAtribute("foos", Foo.values());
-->
<!-- At the jsp -->
<form:select id="theId" path="theModelAttributePath">
<form:options items="${foos}" itemLabel="code"/>
</form:select>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment