JSP中JSTL核心标签库的<c:set>标签
c:set标签两种不同的设置方法如下:
1.var:设置作用域属性;
2.target:设置bean属性或Map值;
c:set标签的两种形式如下:
1.有体:
<c:set var="name" scope="session">
value
</c:set>
2.无体:
<c:set var="name" scope="session" value="value" />
testJSTLlogin.jsp
view plaincopy to clipboardprint?
1. <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
2. <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
3. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
4. <html>
5. <head>
6. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
7. <title>TestJSTLlogin</title>
8. </head>
9. <body>
10. <c:set var="name" value="mgc" scope="session" />
11. </body>
12. </html>
c:set标签两种不同的设置方法如下:
1.var:设置作用域属性;
2.target:设置bean属性或Map值;
c:set标签的两种形式如下:
1.有体:
<c:set var="name" scope="session">
value
</c:set>
2.无体:
<c:set var="name" scope="session" value="value" />
testJSTLlogin.jsp
view plaincopy to clipboardprint?
1. <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
2. <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
3. <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
4. <html>
5. <head>
6. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
7. <title>TestJSTLlogin</title>
8. </head>
9. <body>
10. <c:set var="name" value="mgc" scope="session" />
11. </body>
12. </html>