I would like to have the JSP view, change a select option dynamically based on the returned request parameter from a bean. I know that to do this with a text field, simply place the variable in the input value, but how about with select or with radio menu??
how do you make the select display a certain option when the bean returns to the JSP. I know in static html you can say: selected="selected" but how to do this dynamically?
I have no idea what the previous post is getting at. There is no need to bring the session into this, the HTML is not well formed, and as far as I can tell, the then and else parts of his statement are identical.
All that needs to happen is to stick the selected="selected" on the apporpiate option. [ April 01, 2006: Message edited by: Bear Bibeault ]
Yeh i was trying to show the fact ( bad coding i know ) That in a jsp you could check for an attribute store in a session and display a different select box for different attributes.
e.g In example. One select menu for cars, one for bikes.
If you want the selected option to be stored you could just do
selected="<% myBean.getCarOne() %> "
Hope thats clearer
When it is used for evil, then watch out! When it is used for good, then things are much nicer. Like this tiny ad: