标签:生成 and nal parse 程序 对象 页面 rto add
1 <%@ page language="java" contentType="text/html; charset=UTF-8" 2 pageEncoding="UTF-8"%> 3 <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> 4 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 5 <html> 6 <head> 7 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 8 <title>Insert title here</title> 9 </head> 10 <body> 11 <% 12 pageContext.setAttribute("people","张三"); 13 %> 14 <h2><c:out value="${people}"></c:out></h2> 15 <h2><c:out value="${people2}" default="某人"></c:out></h2> 16 </body> 17 </html>
1 <%@ page language="java" contentType="text/html; charset=UTF-8" 2 pageEncoding="UTF-8"%> 3 <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> 4 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 5 <html> 6 <head> 7 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 8 <title>Insert title here</title> 9 </head> 10 <body> 11 <c:set var="people" value="张三" scope="request"></c:set> 12 <h2><c:out value="${people}"></c:out></h2> 13 <jsp:useBean id="people2" class="cn.cslg.model.People" scope="page"></jsp:useBean> 14 <c:set property="id" target="${people2 }" value="007"></c:set> 15 <c:set property="name" target="${people2 }" value="王二小"></c:set> 16 <c:set property="age" target="${people2 }" value="16"></c:set> 17 <h2>编号:${people2.id }</h2> 18 <h2>姓名:${people2.name }</h2> 19 <h2>年龄:${people2.age }</h2> 20 </body> 21 </html>
1 <%@ page language="java" contentType="text/html; charset=UTF-8" 2 pageEncoding="UTF-8"%> 3 <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> 4 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 5 <html> 6 <head> 7 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 8 <title>Insert title here</title> 9 </head> 10 <body> 11 <c:set var="people" value="张三" scope="request"></c:set> 12 <h2><c:out value="${people}" default="没人啊"></c:out></h2> 13 <c:remove var="people" scope="request"/> 14 <h2><c:out value="${people}" default="没人啊"></c:out></h2> 15 </body> 16 </html>
1 <%@ page language="java" contentType="text/html; charset=UTF-8" 2 pageEncoding="UTF-8"%> 3 <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> 4 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 5 <html> 6 <head> 7 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 8 <title>Insert title here</title> 9 </head> 10 <body> 11 <c:catch var="errMsg"> 12 <% 13 int a=1/0; 14 %> 15 </c:catch> 16 <h2>异常信息:${errMsg }</h2> 17 </body> 18 </html>
1 <%@ page language="java" contentType="text/html; charset=UTF-8" 2 pageEncoding="UTF-8"%> 3 <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> 4 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 5 <html> 6 <head> 7 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 8 <title>Insert title here</title> 9 </head> 10 <body> 11 <jsp:useBean id="people" class="cn.cslg.model.People" scope="page"></jsp:useBean> 12 <c:set property="id" target="${people }" value="007"></c:set> 13 <c:set property="name" target="${people }" value="王二小"></c:set> 14 <c:set property="age" target="${people }" value="16"></c:set> 15 <c:if test="${people.name==‘王二小‘ }" var="r" scope="page"> 16 <h2>是王二小</h2> 17 </c:if> 18 <c:if test="${people.age<18 }"> 19 <h2>是未成年</h2> 20 </c:if> 21 </body> 22 </html>
1 <%@ page language="java" contentType="text/html; charset=UTF-8" 2 pageEncoding="UTF-8"%> 3 <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> 4 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 5 <html> 6 <head> 7 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 8 <title>Insert title here</title> 9 </head> 10 <body> 11 <jsp:useBean id="people" class="cn.cslg.model.People" scope="page"></jsp:useBean> 12 <c:set property="id" target="${people }" value="007"></c:set> 13 <c:set property="name" target="${people }" value="王二小"></c:set> 14 <c:set property="age" target="${people }" value="19"></c:set> 15 16 <c:choose> 17 <c:when test="${people.age<18 }"> 18 <h2>小于18</h2> 19 </c:when> 20 <c:when test="${people.age==18 }"> 21 <h2>等于18</h2> 22 </c:when> 23 <c:otherwise> 24 <h2>大于18</h2> 25 </c:otherwise> 26 </c:choose> 27 </body> 28 </html>
1 <%@ page language="java" contentType="text/html; charset=UTF-8" 2 pageEncoding="UTF-8"%> 3 <%@ page import="cn.cslg.model.*"%> 4 <%@ page import="java.util.*"%> 5 <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> 6 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 7 <html> 8 <head> 9 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 10 <title>Insert title here</title> 11 </head> 12 <body> 13 <% 14 String dogs[]={"小黑","小黄","小白","小小"}; 15 pageContext.setAttribute("dogs",dogs); 16 %> 17 <c:forEach var="dog" items="${dogs }"> 18 ${dog } 19 </c:forEach> 20 <hr/> 21 <c:forEach var="dog" items="${dogs }" step="2"> 22 ${dog } 23 </c:forEach> 24 <hr/> 25 <c:forEach var="dog" items="${dogs }" begin="1" end="2"> 26 ${dog } 27 </c:forEach> 28 <hr/> 29 <% 30 List<People> pList=new ArrayList<People>(); 31 pList.add(new People(1,"张三",10)); 32 pList.add(new People(2,"李四",20)); 33 pList.add(new People(3,"王五",30)); 34 pageContext.setAttribute("pList",pList); 35 %> 36 <table> 37 <tr> 38 <th>编号</th> 39 <th>姓名</th> 40 <th>年龄</th> 41 </tr> 42 <c:forEach var="p" items="${pList }"> 43 <tr> 44 <td>${p.id }</td> 45 <td>${p.name }</td> 46 <td>${p.age }</td> 47 </tr> 48 </c:forEach> 49 </table> 50 </body> 51 </html>
1 <%@ page language="java" contentType="text/html; charset=UTF-8" 2 pageEncoding="UTF-8"%> 3 <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> 4 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 5 <html> 6 <head> 7 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 8 <title>Insert title here</title> 9 </head> 10 <body> 11 <% 12 String str1="www.google.com"; 13 String str2="张三,李四,王五"; 14 pageContext.setAttribute("str1",str1); 15 pageContext.setAttribute("str2",str2); 16 %> 17 <c:forTokens items="${str1 }" delims="." var="s1"> 18 ${s1 } 19 </c:forTokens> 20 <hr/> 21 <c:forTokens items="${str2 }" delims="," var="s2"> 22 ${s2 } 23 </c:forTokens> 24 </body> 25 </html>
1 <%@ page language="java" contentType="text/html; charset=UTF-8" 2 pageEncoding="UTF-8"%> 3 <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> 4 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 5 <html> 6 <head> 7 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 8 <title>Insert title here</title> 9 </head> 10 <body> 11 <c:import url="c_forEach.jsp"></c:import> 12 <c:import url="c_if.jsp"></c:import> 13 </body> 14 </html>
1 <%@ page language="java" contentType="text/html; charset=UTF-8" 2 pageEncoding="UTF-8"%> 3 <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> 4 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 5 <html> 6 <head> 7 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 8 <title>Insert title here</title> 9 </head> 10 <body> 11 <c:url value="http://www.google.com" var="url"> 12 <c:param name="name" value="admin"></c:param> 13 <c:param name="age" value="3"></c:param> 14 </c:url> 15 <a href="${url }">CBA</a> 16 </body> 17 </html>
1 <%@ page language="java" contentType="text/html; charset=UTF-8" 2 pageEncoding="UTF-8"%> 3 <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> 4 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 5 <html> 6 <head> 7 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 8 <title>Insert title here</title> 9 </head> 10 <body> 11 <c:redirect url="target.jsp"> 12 <c:param name="name" value="abc"></c:param> 13 <c:param name="age" value="26"></c:param> 14 </c:redirect> 15 </body> 16 </html>
1 <%@ page language="java" contentType="text/html; charset=UTF-8" 2 pageEncoding="UTF-8"%> 3 <%@ taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn"%> 4 <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> 5 <html> 6 <head> 7 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> 8 <title>Insert title here</title> 9 </head> 10 <body> 11 <% 12 pageContext.setAttribute("info","www.google.com"); 13 %> 14 <h2>查找google位置:${fn:indexOf(info,"google")}</h2> 15 <h2>判断google是否存在:${fn:contains(info,"google")}</h2> 16 <h2>截取:${fn:substring(info,0,5)}</h2> 17 <h2>拆分:${fn:split(info,".")[1]}</h2> 18 </body> 19 </html>
标签:生成 and nal parse 程序 对象 页面 rto add
原文地址:http://www.cnblogs.com/ShawnYuki/p/6358420.html