Java Web EL、JSP、Servlet变量

EL   11                JSP   9                                Servlet  

JSP类别
pageContext pageContext *


作用域
pageScope pageContext.getAttribute() *
requestScope request.getAttribute() HttpServletRequest.getAttribute()
sessionScope session.getAttribute() HttpSession.getAttribute()
applicationScope application.getAttrribute() ServletContext.getAttribute()

参数相关
param request.getParameter() HttpServletRequest.getParameter()
paramValues request.getParameterValues()[返回数组] HttpServletRequest.getParameterValues()
header request.getHeader() HttpServletRequest.getHeader()
headerValues request.getHeaderValues()[返回数组] HttpServletRequest.getHeaderValues()
cookie request.getCookies()[返回数组]; HttpServletRequest.getCookies()


initParam application.getInitParameter() ServletContext.getAttribute()
${requestScope.contextPath }  ====request.getAttribute("contextPath");
${pageContext.request.contextPath} =====pageContext.getRequest().getContextPath()
<%
pageContext.setAttribute("order", 1);
request.setAttribute("order", 2);
session.setAttribute("order", 3);
application.setAttribute("order", 4);
%>
${order}    page-->request-->session-->application 从最小范围开始找找到即停止
c:out escapeXml 是否转义 true 转义(> &lt;)  false 不转义
<c:set target=‘${user}‘ property=‘uuid‘ value=‘1111‘></c:set>    javaBean赋值
<c:set var=‘aaa‘ value="11111" scope="request"/> 给一个变量赋值


<c:forEach varStatus="status" index 当前索引 count 列表大小 first 是不是第一个 last是不是最后一个


<c:url 当禁用掉cookie时 进行URL重写


<c:redirect 不需要上下文 上下文相对地址


core
数据标签 out set remove

控制标签 forEach forTokens if choose

其他标签 url redirect

fmt
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/format" %>
<fmt:formatDate value="${date}" pattern="yyyy-MM-dd"/>
fn
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>

1、${fn:contains("1111", "1") } 第一个字符串是否包含第二个字符串
2、fn:containsIgnoreCase(string, substring)
3、fn:endsWith(string, suffix) → boolean 测试时有问题
4、fn:escapeXml(string) → String
5、fn:indexOf(string, substring) → int
6、${fn:join(paramValues.type, ",")}
7、fn:length(input) → integer
8、fn:replace(inputString, beforeSubstring, afterSubstring) → String
9、fn:split(string, delimiters) → String[]
10、fn:startsWith(string, prefix) → boolean
11、fn:substring(string, beginIndex, endIndex) → String
12、fn:trim(string) → String
13、fn:toLowerCase(string) → String
14、fn:toUpperCase(string) → String

Java Web EL、JSP、Servlet变量,布布扣,bubuko.com

Java Web EL、JSP、Servlet变量

上一篇:appium之adb常用命令


下一篇:Vue中axios的使用