开发者社区> 问答> 正文

SpringMVC select 页面接受参数

public ModelAndView listNewsSearch(

            @ModelAttribute("shortTitle") String shortTitle,

            @ModelAttribute("author") String author,

            @ModelAttribute("sortType") String sortType)

------------------------------------------------------------------------------------

标题 <input name="shortTitle" value="${shortTitle }" type="text">

发布者 <input name="author" value="${author }" type="text">

<select name="sortType" >

<option value="IdAsc">ID升序</option>

<option value="IdDesc">ID降序</option>

</select> 

<input type="button" value="查询" class="btn_search" onclick="go_search();">


输入三个参数查询后,controlle处理完返回到页面,怎么可以让select选中的框是之前选的一样

@ModelAttribute 前两个可以不变 select该怎么写

展开
收起
长安归故里. 2020-01-07 21:27:29 855 0
1 条回答
写回答
取消 提交回答
  • <option value="IdAsc" <c;if sortType =='IdAsc'>selected="true" </c:if> >ID升序</option> 
    
    <option value="IdAsc" <c;if sortType =='IdDesc'>selected="true" </c:if> >ID升序</option>
    
    2020-01-07 21:27:43
    赞同 展开评论 打赏
问答标签:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载