i am working web application on struts 1.3 in netbeans i have two dropdownlist say A and B now i have no probl1em in populating these dropdowns on jsp load ,now user select one value from say dropdown A and value user selected say it is 1 and for another dropdown say B user selected value which is 2 and now user will save these values in database now my requirement is that when we go in edit mode for that when page loads dropdownlist A should have value 1 as preselected and dropdownlist B should have value 2 as preselected. and these values are coming from database my jsp page
RoomForm:-name of my form bean in requst scope list:-Arraylist collection
id:-it is property in Arraylist which is list having getter and setter in bean
name:-it is property in Arraylist which is list having getter and setter in bean
It should work fine if you pre-populate the value before painting the JSP i.e. in your action class itself you set the form bean value, struts should handle this for example, in your scenario set "location" attribute value in "RoomForm" to the desired one and then forward to the JSP.
Have Fun with Java
little,little.. little by little makes a lot..
subject: how to preselect value in dropdownlist in jsp struts