el表达式
什么是el表达式
expresion language
语法结构
${标识符}
作用
1.获取域对象的内容
- ${域对象。键} ${requestScope.username} 简写${键} ${username};
//不指定范围时,从小到大取
pageContext.findAttribute();一托八
2.进行复杂的判断
3.调用javabean的get方法
${javabean对象.属性名} 例如${User.username}
4.获取参数属性值
${param.属性名}
jstl标签库
原理
定义一个类 extends TagSupport类
doStartTag() doEndTage()
在xml文件中定义一下标签名,和对应的类
c标签
// test为条件
<c:choose >
<c:if test=""> 内容</c:if>
/
<c:when test=""></c:when>相当于else if
/
<c:otherwise></c:otherwise>相当于else
</c:choose >
<c:forEach items="${被循环的内容}"(域对象名) var="每次循环取出的内容,保存在域对象中"(对象名称) begin=" " end="">
${取出域对象的内容}
</c:forEach>