File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ <!DOCTYPE html>
2+ < html >
3+ < head >
4+ < meta charset ="UTF-8 ">
5+ < title > www.crazyjava.cn</ title >
6+ </ head >
7+ < body >
8+ < form action ="../JSP/param_values_demo.jsp " method ="post ">
9+ < p > 兴趣</ p >
10+ < input type ="checkbox " name ="inst " value ="唱歌 "/> 唱歌
11+ < input type ="checkbox " name ="inst " value ="游泳 "/> 游泳
12+ < input type ="checkbox " name ="inst " value ="看书 "/> 看书
13+ < input type ="submit " value ="显示 "/>
14+ </ form >
15+ </ body >
16+ </ html >
Original file line number Diff line number Diff line change 1+ <%@ page language =" java" contentType =" text/html; charset=UTF-8"
2+ pageEncoding =" UTF-8" %>
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 >运算符</title >
8+ </head >
9+ <body >
10+ <h1 >比较运算符</h1 >
11+ <b > 4 > ; 3 --> $ {4>3} <br > 4< ; 3-->${ 4 < 3 } <br >
12+
13+ </b >
14+ </body >
15+ </html >
Original file line number Diff line number Diff line change 1+ <%@ page language =" java" contentType =" text/html; charset=UTF-8"
2+ pageEncoding =" UTF-8" %>
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+ <% pageContext. setAttribute(" color" ," lightyellow" ); % >
8+ <title >Insert title here</title >
9+ </head >
10+ <body bgcolor =${pageScope.color} >
11+ <%-- 10+5=${10+5}<br>
12+ 10/5=${10/5}<br> --%>
13+ <%-- ${'${'}true or true}<!-- 注意此处这种写法 --> --%>
14+ <h1 >测试</h1 >
15+ </body >
16+ </html >
Original file line number Diff line number Diff line change 1+ <%@ page language =" java" contentType =" text/html; charset=UTF-8"
2+ pageEncoding =" UTF-8" %>
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 >get_attribute_demo</title >
8+ </head >
9+ <body >
10+ <%
11+ pageContext. setAttribute(" info" , " page属性范围" );
12+ request. setAttribute(" info" , " request属性范围" );
13+ session. setAttribute(" info" , " session属性范围" );
14+ application. setAttribute(" info" , " application属性范围" );
15+ % >
16+ <h3 >page属性内容:${ pageScope. info } </h3 >
17+ <h3 >request属性内容:${ requestScope. info } </h3 >
18+ <h3 >session属性内容:${ sessionScope. info } </h3 >
19+ <h3 >application属性内容:${ applicationScope. info } </h3 >
20+ </body >
21+ </html >
Original file line number Diff line number Diff line change 1+ <%@ page language =" java" contentType =" text/html; charset=UTF-8"
2+ pageEncoding =" UTF-8" %>
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 >www.crazyjava.cn</title >
8+ </head >
9+ <body >
10+ <h3 >IP地址:${ pageContext. request. remoteAddr } </h3 >
11+ <h3 >SESSION ID:${ pageContext. session. id } </h3 >
12+ <%-- <h3>是否是新:${pageContext.session.isNew()}</h3>该段代码可用,但是会报语法检查错误--%>
13+ </body >
14+ </html >
Original file line number Diff line number Diff line change 1+ <%@ page language =" java" contentType =" text/html; charset=UTF-8"
2+ pageEncoding =" UTF-8" %>
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 >www.crazyjava.cn</title >
8+ </head >
9+ <body >
10+ <%
11+ request. setCharacterEncoding(" UTF-8" );
12+ % >
13+ <h3 > 第一个参数:${ paramValues. inst[0 ] } </h3 >
14+ <h3 > 第二个参数:${ paramValues. inst[1 ] } </h3 >
15+ <h3 > 第三个参数:${ paramValues. inst[2 ] } </h3 >
16+ </body >
17+ </html >
Original file line number Diff line number Diff line change 1+ <%@ page language =" java" contentType =" text/html; charset=UTF-8"
2+ pageEncoding =" UTF-8" %>
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 >print_attribute_demo01</title >
8+ </head >
9+ <body >
10+ <%
11+ request. setAttribute(" info" , " www.crazyjava.cn" );
12+ if (request. getAttribute(" info" ) != null ) {
13+ % >
14+ <h3 ><%= request. getAttribute(" info" ) % > </h3 >
15+ <%
16+ }
17+ % >
18+ </body >
19+ </html >
Original file line number Diff line number Diff line change 1+ <%@ page language =" java" contentType =" text/html; charset=UTF-8"
2+ pageEncoding =" UTF-8" %>
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 >print_attribute_demo02</title >
8+ </head >
9+ <body >
10+ <%
11+ request. setAttribute(" info" ," www.crazyjava.cn" );
12+ % >
13+ <h3 > ${ info } </h3 >
14+ </body >
15+ </html >
Original file line number Diff line number Diff line change 1+ <%@ page language =" java" contentType =" text/html; charset=UTF-8"
2+ pageEncoding =" UTF-8" %>
3+ <%@page import =" java.util.*" %>
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 >www.crazyjava.cn</title >
9+ </head >
10+ <body >
11+ <!-- 测试list集合操作-->
12+ <%
13+ List all = new ArrayList ();// 注意导包
14+ all. add(" crazy" );
15+ all. add(" www.crazyjava.cn" );
16+ 17+ request. setAttribute(" allinfo" , all);
18+ % >
19+ <h3 >第一个元素:${ allinfo[0 ] } </h3 >
20+ <h3 >第二个元素:${ allinfo[1 ] } </h3 >
21+ <h3 >第三个元素:${ allinfo[2 ] } </h3 >
22+ <hr >
23+ <%
24+ Map map = new HashMap ();
25+ map. put(" crazy" , " 阿超" );
26+ map. put(" website" , " www.crazyjava.cn" );
27+ map. put(" email" , " [email protected] " ); 28+ request. setAttribute(" info" , map);
29+ % >
30+ <h3 >KEY为crazy的内容:${ info[" crazy" ] } </h3 >
31+ <h3 >KEY为website的内容:${ info[" website" ] } </h3 >
32+ <h3 >KEY为email的内容:${ info[" website" ] } </h3 >
33+ </body >
34+ </html >
Original file line number Diff line number Diff line change 1+ <%@ page language =" java" contentType =" text/html; charset=UTF-8"
2+ pageEncoding =" UTF-8" %>
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 >repeat_attribute_Demo</title >
8+ </head >
9+ <body >
10+ <%
11+ pageContext. setAttribute(" info" , " page属性页面" );
12+ request. setAttribute(" info" , " request属性页面" );
13+ session. setAttribute(" info" , " session属性页面" );
14+ application. setAttribute(" info" , " application属性页面" );
15+ % >
16+ <h3 >${ info } </h3 >
17+ </body >
18+ </html >
You can’t perform that action at this time.
0 commit comments