File: Test.jsp

package info (click to toggle)
libnb-platform18-java 12.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 729,800 kB
  • sloc: java: 5,059,097; xml: 574,432; php: 78,788; javascript: 29,039; ansic: 10,278; sh: 6,386; cpp: 4,612; jsp: 3,643; sql: 1,097; makefile: 540; objc: 288; perl: 277; haskell: 93
file content (116 lines) | stat: -rw-r--r-- 3,211 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<%@page contentType="text/html;charset=UTF-8"%>
<%@page pageEncoding="UTF-8"%>
<%@page import="java.util.Date"%>

<html>
<head>
  <title>JSP Page</title>
</head>

<body>

<h1>Testing JSP</h1>

<i>This is JSP which contains as many as possible JSP structures.</i><br>

<i>Now we are testing HTML comment which should appear in page.</i><br>
<!-- one line HTML comment -->

<i>And now HTML comment split to more lines.</i><br>
<!-- this is HTML comment
     split to 
     more lines -->
     
<i>Now we are testing JSP comment which should not appear in page.</i><br>    
<%-- one line JSP comment --%>

<i>And now JSP comment splt to more lines.</i><br>
<%-- this is JSP comment
     split to 
     more lines --%>

<i>Test of variable declaration.</i><br>     
<%! int i = 1; %>

<i>Test of multiple variable declaration.</i><br>     
<%! int a = 0;
    int b;
    int c = 1;
%>

<i>Test of one line scriptlet.</i><br>     
<%  out.println("This is output from scriptlet<br>"); %>

<i>Test of mutliple line scriptlet.</i><br>
<%  out.println("This is output from another scriptlet<br>"); 
    Date date = new Date();
    out.println("Today is "+date.toString()+"<br>");
    a = i + i;
    b = 2; c = b * b;
    out.println("1 + 1 = "+a+"<br>");
    out.println("2 * 2 = "+c+"<br>");
%>

<i>Test of expression.</i><br>
Free memory: <%=Runtime.getRuntime().freeMemory()%><br>

Used memory: <%=Runtime.getRuntime().totalMemory() - 
                Runtime.getRuntime().freeMemory()%><br>
     
<i>Test of beans.</i><br>     
<jsp:useBean id="testBean" scope="session" class="test.TestBean" />
<jsp:setProperty name="bean" property="intProperty" value="100"/>
intProperty = <jsp:getProperty name="bean"  property="intProperty"/><br>

1 + 2 = ${1 + 2} <br>
intProperty = ${bean["intProperty"]}<br>

<h2>And once again</h2>

<i>This is JSP which contains as many as possible JSP structures.</i><br>

<i>Now we are testing HTML comment which should appear in page.</i><br>
<!-- one line HTML comment -->

<i>And now HTML comment split to more lines.</i><br>
<!-- this is HTML comment
     split to 
     more lines -->
     
<i>Now we are testing JSP comment which should not appear in page.</i><br>    
<%-- one line JSP comment --%>

<i>And now JSP comment splt to more lines.</i><br>
<%-- this is JSP comment
     split to 
     more lines --%>

<i>Test of one line scriptlet.</i><br>     
<%  out.println("This is output from scriptlet<br>"); %>

<i>Test of mutliple line scriptlet.</i><br>
<%  out.println("This is output from another scriptlet<br>"); 
    date = new Date();
    out.println("Today is "+date.toString()+"<br>");
    i = 1;
    a = i + i;
    b = 2; c = b * b;
    out.println("1 + 1 = "+a+"<br>");
    out.println("2 * 2 = "+c+"<br>");
%>

<i>Test of expression.</i><br>
Free memory: <%=Runtime.getRuntime().freeMemory()%><br>

Used memory: <%=Runtime.getRuntime().totalMemory() - 
                Runtime.getRuntime().freeMemory()%><br>
     
<i>Test of beans.</i><br>     
<jsp:setProperty name="bean" property="intProperty" value="200"/>
intProperty = <jsp:getProperty name="bean"  property="intProperty"/><br>

1 + 2 = ${1 + 2} <br>
intProperty = ${bean["intProperty"]}<br>

</body>
</html>