jsp脚本:<%=request.getAttribute(name)%>
EL表达式替代上面的脚本:${requestScope.name}
使用EL最主要的作用是获得四大域中的数据,格式${EL表达式}
此表达式主要终于代替findAttribute(String name),取值顺序相同
---同样是依次从pageContext域,request域,session域,application域中
引入头文件
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!-- 取值 -->
${name}
<!-- 对象取值 对象.属性名 -->
${user.id}.....${user.username}.....${user.pwd}
<!-- 集合取值Key[0].属性名 -->
${List[0].id}
<!-- 项目名 -->
${pageContext.request.contextPath}
<!-- el执行表达式 -->
${50*900000}
${empty user }
${user==null?"空的":user.username }
<!-- 取map集合 循环增强 -->
<c:forEach items="${map }" var= "entry">
${entry.key }....${entry.value.username }
</c:forEach>
<!--非增强循环-->
<c:forEach begin="0" end="10" var= "entry">
${entry}
</c:forEach>
使用if判断
<c:if test="${count==10}">
aaa
</c:if>
EL表达式用法---查询博客
猜你喜欢
转载自www.cnblogs.com/xiaozhang666/p/10678883.html
今日推荐
周排行