Jul 8th, 2012, 05:15 AM
customize web view for integer field
Hi roo users !
Just making my first steps with roo and the MVC scaffolding. (jspx tags)
I am working on a simple asessment form and my entity needs to store an integer value but in the
UI this should be presented as a dropdown list where initially nothing is selected. So the model looks
something like this:
- please select
value : 1 should be displayed as "first option"
value : 2 should be displayed as "second option"
The example from the spring reference documentation "188.8.131.52 The options tag" looks good to me but
I am confused about the difference between "select" and "form:select" tags. The tags in the auto generated
jspx files use other tags <field:select> which do not support nested option elements as shown in the spring docs.
Can anyone provide me with an example that would work with my scenario ?
Jul 8th, 2012, 11:50 AM
The select has an items attribute. This must reference the list with your options.
It should be automatically added when your number is an enum.
Jul 8th, 2012, 12:49 PM
I do not need an enum, I am just looking for a way to distinguish between the value that is actually stored (1,2,3,4....) in my case
and the label in the drop down that is displayed to the user.
And my confusion is about the various <select> tags available. The code in the spring docs seems to use a different taglib
than the one used in the generated jspx code. I want to modify the generated jspx file according to the example in the docs but don't know how to archive this.
In my case (an asessment form) I dont wan't the first possible value to be automatically selected I need some "please choose" dummy element to force the user to explicitly make a choice.
Jul 8th, 2012, 12:56 PM
Roo indeed does not use the form:select from the spring taglib.
Just use the select-tag from roo and provide an items-attribute with itemLabel and itemValue. You have to put this into the model in your controller.
Tags for this Thread