I have used this method throughout my project to make a select show the value that the user picked on a previous page, it works in multiple other loactions in the project when passing only a normal object not in a session
<option value='dublin'
${locs.county == 'dublin'? "selected" : ""}>Dublin</option>
locations however when I attempt to uses it with a session nothing happens, the code is
<c:set var = "con" value = "${sessionScope.User.county}"/>
<c:out value = "${con}"/>
<div class="col-sm-8">
<select name="county" class="form-control selectPadHeight">
<option value='kerry'
${sessionScope.User.county == 'kerry'? "selected" : ""}>Kerry</option>
<option value='kildare'
${sessionScope.User.county == 'Kildare'? "selected" : ""}>Kildare</option>
<option value='kilkenny'
${sessionScope.User.county == 'kilkenny'? "selected" : ""}>Kilkenny</option>
the session value works as the variable con successfully prints kildare. I tried using con to compare but that also does not work, any help would be greatly appericated
Aucun commentaire:
Enregistrer un commentaire