本文共 1250 字,大约阅读时间需要 4 分钟。
action参数为:<c:out value="${action }" default="No parameter named 'action' found"/> <c:if test="${param }=='add'}"> Hello </c:if> if标签没有else的功能,代替方案 <c:choose> <c:when test="${empty param }"> when标签的输出 </c:when> <c:otherwise> otherwise标签的输出 </c:otherwise> </c:choose> 用来迭代集合 <c:forEach var="num" begin="2" end="20" step="2"> <div>${num}</div> </c:forEach> <% List<Integer> s=new ArrayList<Integer>(); s.add(1); s.add(2); s.add(3); request.setAttribute("s",s); %> <c:forEach items="${s }" var="a"> ${a} </c:forEach> 遍历字符串 <c:forTokens items="Jane,Tomi,Andy,Hedrix,McCartney" delims="," var="item" varStatus="varStatus"> ${varStatus.index } ${item } </c:forTokens> set标签实现存值,既可以声明一个不存在的对象,也可以,修改一个已经存在对象的某个属性 <c:set var="totalCount" value="1" scope="page"/> <!-- target作用用来操作javabean <c:set target="${person}" property="name" value="${param.name}"/> <c:set target="${map}" property="name" value="${param.name}"/> --> <!-- <c:remove/>标签用来移除page、request,session,application中的数据 <c:remove var="somemap"/> --> 捕捉异常 <c:redirect url="https://www.baidu.com"/> 相对路径 <c:redirect url="/index.jsp" context="/jstl"/> <c:param/>标签传值 <c:redirect url="/index.jsp" context="/jstl"> <c:param name="wd" value="音乐"/> <c:param name="cl" value="2"/> </c:redirect>转载地址:http://yvjqi.baihongyu.com/