Wednesday, July 15, 2009

jsp session

Add this code to the top of the jsp page.

<%@ page import="java.util.*" session="true"%>

Then you can get the session id of the browser and the server.

This id is unique for a browser window.

<% String sessionId=session.getId(); %>

And, you can aloso set your own variable for session. There is a method as "setAttribute".

Use this to set your own attribute for a session.

session.setAttribute("user",username);

No comments:

Post a Comment