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.
Hi I am using html:select tag and populating it dynmically with values from the database. As soon as i select second value from the drop down combo box list, the same page will be refreshed with different set of page contents.
The only problem is that the drop down combo box is set to the selected value. But it points to the first value in the list.
One example showing how to fill countries in a select box. countryList = list of all countries from DB country = form level variable (representing selected country)
Let say you are using this in JSP: <html:select name="FFAgencyForm" property="country" styleClass="se1"> <html ption value="">Select a Country</html ption> <html ptionsCollection property="countryList" value="countryCode" label="countryName"/> </html:select>
now in Action, you do:
ArrayList countryList= ffAgencyBO.getCountryList(); // get list form.setCountryList(countryList); // set list to select
To show selected value, pass value of that selected Text to set the variable that is represented by this list. i.e. form.setCountry(request.getParameter("country"));