|
|
||||
|
||||
|
|
||||
|
||||
|
|
|
|
||||
|
||||
|
|
||||
|
||||
|
|
Select Default Value | |
|
Question:
Here is a code fragment from a JSP page:
foodTypeList is a collection that has these elements:-
How do I set Snack as the default? Answer: The html:select tag will show the option as "selected" that matches the current value of the ActionForm bean property that is specified in the "property" attribute of the tag. So, if you want to set a default value, you have to set the ActionForm bean property. In your example, let's suppose that that myActionForm is a local variable that refers to your ActionForm bean, the following statement would do the job: myActionForm.setFoodType("02"); Here are your options:
Return to StrutsFaq | |