How do I mainitain the selected value from the dropdown list so when the jsp is redisplayed, the selected values are maintained (are shown) and not lost?
Michael J. Payne Consultant Fusion Alliance Indianapolis, Indiana
You have to generate appropriate HTML to indicate which records in the list are selected. Basically for whichever option is selected, you have to have <option value="42" selected="true">
Frameworks like struts/JSF will often take care of this for you, otherwise you do it manually, with an if statement in the middle of your rendering the list. Another approach is to render the list as usual, and then execute a javascript command onload which sets the value. It sometimes looks a bit neater in code ;-)
is probably a poor way to express this because it would lead one to believe that saying selected="false" would have the opposite effect.
In XHTML, if anything is supplied as a value to the selected attribute -- be it selected="true" or selected="false" or even selected="sdhsjhdsh" -- the option will be selected.
This is true of all attributes that have no value in HTML but must have a value in XHTML.
The standard means of expressing these is to repeat the name of the attribute. E.g. selected="selected". [ October 19, 2006: Message edited by: Bear Bibeault ]