I have a page with a select (drop-down). It will have values like:
"SUN" - "Sunday"
"MON" - "Monday"
"TUE" - "Tuesday"
etc.
I can:
- store the list of values inside of the page (JSP-page) with
‘option‘ tag - keep it in a Map in MyForm.class and pass it to the page from
Controller using ‘options‘ tag.
The current example is about days of the week(there are only 7 of them), but is also applicable to days of the month (the amount of data becomes bigger), etc.
What will be the better way?
P.S. I’m using Java, JSP and Spring Framework
This type of data should be exposed through a controller or encapsulated in a custom tag (or both).
You don’t want to hard-code strings into a JSP (in general) because of I18N issues, although you could do the I18N for that in the JSP, it’s just more verbose.