<%@page contentType="text/html"%> <%@page pageEncoding="UTF-8"%> <%@page import = "java.util.*" session="true"%> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>JSP Page</title> </head> <body> <h1>JSP Page</h1> <% Integer sessCounter = (Integer)session.getAttribute("sessCounter"); if(sessCounter == null) sessCounter = new Integer(1); else sessCounter = new Integer(sessCounter.intValue()+1); session.setAttribute("sessCounter", sessCounter); %> <br> ID sesji: <%=session.getId()%> <br> Ta sesja zaczela sie <%=new Date(session.getCreationTime())%> <br> Odwiedziles od tego czasu te strone: ${sessionCounter} raz(y) <br><br> Teraz wpisales: ${param.f_value} <br> Ostatnio wpisales: ${sessionScope.userText} <form method="post"> <input type="text" name="f_value" /> <input type="submit" value="wyslij" /> </form> <br> <% session.setAttribute("userText", request.getParameter("f_value")); %> </body> </html>