java - sending request parameter from action method to jsp -
i have form drop downwards list in jsp page
<html:form action="/accountprocess"> <html:hidden property="dispatch" value="getusers" /> <select name="user_status_filter" onchange="this.form.submit()"> <option value="status">status</option> <option value="all" >all</option> <option value="inactive">inactive</option> <option value="active">active</option> </select> </html:form>
in action method i'm doing following:
string requestvalue = requestutils.getstringparameter(request, "user_status_filter");
and it's working great, want send same exact string can add together "selected" string right alternative element maintain selected when form submitted.
right i'm doing in action method
request.setattribute("selectedvalue", requestvalue);
but don't know how add together conditional logic jsp it's like
if (${selectedvalue}.equals("all") <option value="all" selected>all</option>
try
<option value="all" ${selectedvalue == 'all' ? 'selected' : ''}>all</option>
just alter value compare in every <option>
.
java jsp servlets
No comments:
Post a Comment