写代码时碰到的一个问题,类似下的面的代码:
<select name="selecttype"> <option value="" selected>--请选择--</option> <option value="1" <c:iftest="${type==1}">selected="selected" </c:if>>正 常 </option> <option value="0" <c:if test="${type==0}"> selected="selected" </c:if>>暂 停 </option> <option value="-1" <c:if test="${type==-1}"> selected="selected" </c:if>>废 弃 </option> </select> <input type="submit" value="查询" style="width: 80px" />
如果什么都不选,点查询按钮时返回全部数据。
在tomcat6.x服务器下包含以上代码的页面显示正常但在resin3.x服务器下如果什么都不选点查询按钮的话,,<select>中的值会变成"暂停"而不是默认的"--请选择--"最后把el表达式中的${type==1}换成${type=='1'}后,在resin3.x下就可以正常显示了.