
















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!

















JSP is Easy
JSP is as easy as ...<%-- Calculate the sum of 1 + 2 + 3 dynamically --%>1 + 2 + 3 =
JSP is Easy
JSP is as easy as ... <%-- Calculate the sum of 1 + 2 + 3 dynamically --%> 1 + 2 + 3 =
**JSP is Easy **
JSP is as easy as ... <%-- Calculate the sum of 1 + 2 + 3 dynamically --%> 1 + 2 + 3 =
** **
<%@ page language="java" contentType="text/html" %><%!
int globalCounter = 0; %>
A page with a counter
This page has been visited: <%= ++globalCounter %> times.
<%
int localCounter = 0;
%>This counter never increases its value: <%= ++localCounter %>
<%@ page language="java" contentType="text/html" %><%@ page import="java.util.Date" %> <%!int globalCounter = 0;java.util.Date startDate;public void jspInit( ) {
startDate = new java.util.Date( ); } public void jspDestroy( ) {
ServletContext context = getServletConfig().getServletContext( );
context.log("test.jsp was visited " + globalCounter +" times between " + startDate + " and " + (new Date( ))); } %> A page with a counter
This page has been visited:
<%= ++globalCounter %>
times
since
<%= startDate %>
.
-^
-^
-^
-^