下面的代码中默认的<option>选择文章类型</option>因为没有设置value属性,该下拉框非必选,在没有选择时候,也就是默认<option>选择文章类型</option>时候
<select name="articleType" id="articleType" >
<option>选择文章类型</option>
<option value="1" <c:if test="${pd.articleType == 1 }">selected</c:if> >新闻公告</option>
<option value="2" <c:if test="${pd.articleType == 2 }">selected</c:if> >园区创新</option>
</select>
后台接收方法:
@RequestMapping(value="/edit")
public ModelAndView edit(AppMenu model){
}
提交数据时候会报出下面的错误:
HTTP Status 400 -
type Status report
message
description The request sent by the client was syntactically incorrect.
Apache Tomcat/8.5.6
解决办法:
给该option加上value属性:
<option value="">选择文章类型</option>