0
我有一個表格,在我的操作方法下拉列表在JSP頁面中發送請求參數的jsp
<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>
我做了以下內容:
String requestValue = RequestUtils.getStringParameter(request, "user_status_filter");
和它工作的很好,但我也想發回相同的確切字符串,以便我可以將「選定」字符串添加到右邊的選項元素,以便在提交表單時保持它被選中。
現在我在我的操作方法
request.setAttribute("selectedValue", requestValue);
這樣做,但我不知道如何有條件的邏輯添加到我的JSP,以便它像
if (${selectedValue}.equals("all")
<option value="all" selected>All</option>
謝謝你現在試試! – 2014-10-16 14:03:27
它不工作...請問request.setAttribute和jsp之間有沒有找到它? – 2014-10-16 14:06:18
你正在做一個完整的帖子,對吧?不是AJAX請求? – 2014-10-16 14:07:14