This week's book giveaway is in the OCMJEA forum. We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line! See this thread for details.
I have a dropdown which is being populated from an arraylist using JSTL.
There is an onchange event on this dropdown, which submits the form to the
server and returns the results.
Everything works fine, except for:
* When the page refreshs after onchange even triggers form submission, There
drop down value isnt restored. It basically defaults to the top one.
For example, if the dropdown has three options: AAA, BBB, CCC
and I pick BBB (which will submit the form with value BBB), Now on the refreshed page
I should see BBB as the dropdown value, where as its showing me AAA.
Below line of code will work fine, if I have the value hardcoded.
How do I achieve the same when dropdown is populated with a for loop.
So you think that A should equal B, but in your code, A doesn't equal B? Then the next step would be to look at A and B and see for yourself why they are different.
Joined: Oct 30, 2008
Thats not the problem. Lets say, if I picked CCC from the dropdown, so this will trigger the form to submit, which in turn returns some data back on the page. After this refresh, I want the same CCC value to be highlighted in the dropdown.