EL 表达式用法的一些总结
src url:http://www.blogjava.net/vickzhu/archive/2008/09/24/230831.html
1、是否为空:
${empty sessionScope.username}
2、是否不为空
${not empty sessionScope.username}
3、得到请求参数
${param.username}
4、判断数字
${requestScope.age==20}
5、判断字符串
${requestScope.username=='vickzhu'}
或者${requestScope.username=="vickzhu"}
6、选中单选、复选、下拉框
下拉框:<option value="${cityInfo.cityCode }" ${param.cityCode==cityInfo.cityCode? "selected='selected'":"" } >${cityInfo.cityName }</option>
单选、复选:
<input name="gender" type="radio" ${param.gender==1?"checked='checked'":"" } value="1" />男
<input name="gender" type="radio" ${param.gender==2?"checked='checked'":"" } value="2" />女