Hello,
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.
<option value="<c:out value='AAA'/>" ><c:if test="${transaction eq 'AAA'}"> selected='selected'</c:if> ><c:out value='AAA'/></option>
How do I achieve the same when dropdown is populated with a for loop.
# <c:forEach var="application" items="${applications}">
# <option value="<c:out value='${application}'/>" ><c:if test="${transaction eq '${application}'}"> selected='selected'</c:if> ><c:out value='${application}'/></option>
# </c:forEach>
this condition is causing the trouble for me
<c:if test="${transaction eq '${application}'}">