| 1 |
<%-- initial comment --%> |
| 2 |
<%@ page import="java.util.Date" %> |
| 3 |
<%--@ page isELIgnored="true" //Now EL will be ignored --%> |
| 4 |
<html> |
| 5 |
<jsp:declaration> |
| 6 |
int day = 3; |
| 7 |
</jsp:declaration> |
| 8 |
<%@ include file="relative url" %> |
| 9 |
<jsp:directive.include file="relative url" /> |
| 10 |
<head> |
| 11 |
<title>Day <%= day %></title> |
| 12 |
</head> |
| 13 |
<body> |
| 14 |
<script> |
| 15 |
var x = "abc"; |
| 16 |
function y { |
| 17 |
} |
| 18 |
</script> |
| 19 |
<style> |
| 20 |
.class { |
| 21 |
background: #124356; |
| 22 |
} |
| 23 |
</style> |
| 24 |
|
| 25 |
<p> |
| 26 |
Today's date: <%= (new java.util.Date()).toLocaleString()%> |
| 27 |
</p> |
| 28 |
<%! int day = 3; %> |
| 29 |
|
| 30 |
<jsp:directive.page attribute="value" /> |
| 31 |
|
| 32 |
|
| 33 |
<%-- This comment will not be visible in the page source --%> |
| 34 |
<!-- html comment --> |
| 35 |
<body> |
| 36 |
<p> |
| 37 |
Today's date: <%= (new java.util.Date()).toLocaleString()%> |
| 38 |
</p> |
| 39 |
|
| 40 |
<%! int i = 0; %> |
| 41 |
<jsp:declaration> |
| 42 |
int j = 10; |
| 43 |
</jsp:declaration> |
| 44 |
|
| 45 |
<%-- This is JSP comment --%> |
| 46 |
<%@ directive attribute="value" %> |
| 47 |
|
| 48 |
<h2>Select Languages:</h2> |
| 49 |
|
| 50 |
<form ACTION="jspCheckBox.jsp"> |
| 51 |
<input type="checkbox" name="id" value="Java"> Java<BR> |
| 52 |
<input type="checkbox" name="id" value=".NET"> .NET<BR> |
| 53 |
<input type="checkbox" name="id" value="PHP"> PHP<BR> |
| 54 |
<input type="checkbox" name="id" value="C/C++"> C/C++<BR> |
| 55 |
<input type="checkbox" name="id" value="PERL"> PERL <BR> |
| 56 |
<input type="submit" value="Submit"> |
| 57 |
</form> |
| 58 |
|
| 59 |
<% |
| 60 |
String select[] = request.getParameterValues("id"); |
| 61 |
if (select != null && select.length != 0) { |
| 62 |
out.println("You have selected: "); |
| 63 |
for (int i = 0; i < select.length; i++) { |
| 64 |
out.println(select[i]); |
| 65 |
} |
| 66 |
} |
| 67 |
%> |
| 68 |
|
| 69 |
|
| 70 |
<% |
| 71 |
switch(day) { |
| 72 |
case 0: |
| 73 |
out.println("It\'s Sunday."); |
| 74 |
break; |
| 75 |
case 1: |
| 76 |
out.println("It\'s Monday."); |
| 77 |
break; |
| 78 |
case 2: |
| 79 |
out.println("It\'s Tuesday."); |
| 80 |
break; |
| 81 |
case 3: |
| 82 |
out.println("It\'s Wednesday."); |
| 83 |
break; |
| 84 |
case 4: |
| 85 |
out.println("It\'s Thursday."); |
| 86 |
break; |
| 87 |
case 5: |
| 88 |
out.println("It\'s Friday."); |
| 89 |
break; |
| 90 |
//hello |
| 91 |
default: |
| 92 |
out.println("It's Saturday."); |
| 93 |
} |
| 94 |
%> |
| 95 |
<p> |
| 96 |
<jsp:scriptlet> |
| 97 |
out.println("Your IP address is " + request.getRemoteAddr()); |
| 98 |
</jsp:scriptlet> |
| 99 |
</p> |
| 100 |
</body> |
| 101 |
</html> |