This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
I have a JSP Page with two select boxes. When I write the Usual HTML code for the two DropDown, everything seems to be in place. But as soon as I replace <select> and <option> with <html:select> and <html ption> tags, I cannot see any dropdown kinda thing and also, the options come as normal labels in the same line.I ahve imported the requited .tld files also. Below mentioned is my Code
and the taglibs are in your web.xml that should work, when the html page opens up view source and see what you have. It may not be being parsed properly?
While we're on this topic I have a question also, I want to know if I set the options through an action form reset can I then select which one of them if to be selected by default? So it would be blue already when the jsp is displayed.
Just wanted to make an observation, it may not be the reason your code is not working.
The <htmlption> tags need to have a valid "value" attribute. These are currently empty in your case. The "value" will be submitted when an option is selected. It is also used to determine which option to show as selected when the page loads.
And John, the answer to your question is yes. But remember to put appropriate values in the "value" attribute. Also you have to use either <htmlption> or <htmlptions>. Using normal <option> will not work for showing an option as selected when a page loads.
Joined: Oct 30, 2002
I tried putting the value in the value attribute of html ption tag . But that doesn't work either. I have imported the strtuts-html.tld with the correct path . Also its has entry in my web.xml. Can it because I have not put my ActionForm.class file in the classes folder of WEB-INF ??