I store Birthday Month in database as value using following code in JSP.
<select name="birthday_month" id="birthday_month">
<option value="-1">Month</option>
<option value="1">Jan</option>
<option value="2">Feb</option>
...
</select>
Output code in JSP to show previously selected item using JSTL that I am using (which is not correct)
<select name="birthday_month" id="birthday_month">
<c:forEach var="value" items="${birthdaymonth}">
<option value="${birthdaymonth}">${birthdaymonth}</option>
<option value="1">Jan</option>
<option value="2">Feb</option>
...
</c:forEach>
</select>
What I am getting from this code is value like 1 or 2 in select tag
Other Information:
- I store birthday month as value like 1,2,3.. for Jan,Feb,Mar... in Database
- I bring value of birthday month in request scope in Servlet using
request.setAttribute("birthdaymonth", user.getBirthdayMonth());
What i was expecting
- When i show later JSP it should show previously stored birthday month as Jan,Feb, Mar and not 1,2,3 and also show other Option values including selected item as highlighted.