Hi,
I am using the following code in my JSP. Actually when i submit this jsp to a servlet then it sets the value of location attribute using request.setAttr ibute() and forwards it using RequestDispatch er and include.But when the JSP page reloads there is no effect of if-else.
Thanks
I am using the following code in my JSP. Actually when i submit this jsp to a servlet then it sets the value of location attribute using request.setAttr ibute() and forwards it using RequestDispatch er and include.But when the JSP page reloads there is no effect of if-else.
Code:
<% if(request.getAttribute("location").equals("Chandigarh")){ %>
<select name="Location">
<Option value="Chandigarh" selected>Chandigarh</Option>
<Option value="Pune">Pune</Option>
</select>
<%}
else if(request.getAttribute("location").equals("Pune")){%>
<select name="Location">
<Option value="Pune" selected>Pune</Option>
<Option value="Chandigarh">Chandigarh</Option>
</select>
<% }
else{ %>
<select name="Location">
<Option value="Banglore" selected>Banglore</Option>
<Option value="Chandigarh">Chandigarh</Option>
</select>
<% } %>
Comment