The Above Says that we need a value to be compared for marking an option selected...so how can i implement that part of logic...can you please advice.....???
and the option to be preselected has to be validated against the value fetched from database.....so can you please advice on how to implement this logic in Struts.
In the above, you are hardcoding the value attribute, but i need to dynamically set the default selected value of the Struts drop down list into the "value" Attribute.Could you please help me out with this.
Please find my code below....Please help me on how to proceed.
1st dop down list is having countries --> Australia,India,UK
2nd drop down list is also having countries --> USA,Canada,Brazil
Both the drop down list are being displayed in jsp using logic iterate tag
im doing a logic iterate over this and 2 drop down list's are displayed correctly
the problem is now that i need the default value for the 1st dropdown and 2nd drop down to be selected on the basis of the value in database.
1> Default value of 1st dropdown list is Australia ,which is fetched from database
2> Default value of 2nd dropdown list is Brazil ,which is fetched frm database
How should i modify the code to achieve this...because i have 2 dropdownlists being iterated using logic:iterrate tag.
Could you help me with this issue since i dont know how to proceed. i have read post saying we need to set the value attribute,but how do i set the value dynamically in the
<html:select .....> struts tag.....
Now, in your case, your using the struts <html:options collection="..." ../> element, e\which doesn't provide any method to preselcet the default value. So solutions may fit in your case:
1. On page load, call JS and and select that option
2. or simply use <html:option > tag and use the "selected" attribute.