Announcement Announcement Module
No announcement yet.
customize web view for integer field Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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 " 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 ?


  • #2
    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.


    • #3
      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.



      • #4
        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.