This week's book giveaway is in the Mac OS forum. We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line! See this thread for details.
I am using JSTL for displaying the dropdown. After selecting value, I am saving selected value in dropdown. When I retrieve it from the data base, I need to auto select that value from could someone help please. Thanks.
There are several ways of accomplishing preselection of a row in STRUTS. It looks like the option you have chosen is to loop through your Collection yourself and build your select box manually. In this case you have to place the conditional statement, which I believe is another logic tag, that tests whether the value you'd like to preselect has been reached in the loop, and if so you'll have to output the option line with the selected attribute set.
Other options are using the the html:options or html:optionsCollection STRUTS tags and using their api to preselect the value for you.
Joined: Dec 27, 2001
Thanks Rudy. Actually I did not change anny code in jsp. I just passed the value from the database and JSTL took care of pre-selecting.
Note : I have a conditional statement in FormBean.
subject: Auto selecting value in dropdown using JSTL