If this is your first visit, be sure to
check out the FAQ by clicking the
link above. You may have to register
before you can post: click the register link above to proceed. To start viewing messages,
select the forum that you want to visit from the selection below.

Thanks but I really don't know how to use the method. I got this message when I tried it:
Can't make static reference to method void invalidate() in interface javax.servlet.http.HttpSession. HttpSession.invalidate();

If I would have been you I would invalidate the session when the user enters the application.

When you use a servlet or JSP(it still servlet) you have access to an object called request. Actually it is javax.servlet.http.HttpServletRequest. By this object all the servlets, including JSP communicate - they simply forward it to one antoher. This request holds all the HTTP CGI parameters sent by the web browser or added by any servlet or JSP(it is servlet) . It also holds a session object - HttpSession. You get the session by:

request.getSession(boolean). If the paramter is true then if there is no session a new one is created. if false - you get null if session is not created.

So in you doGet/doPost you receive request and response. In a JSP you have the predefinite parameters session, request and etc.

When talking about session tracking or just site navigation you can put a parameter in the session that will be changed whenever you go to a specific page. For example if the user clicks exit you set its value to -1. if he is on page 2 - set it to value of 2. When navigating you will always know what is he watching and you can control him ). If the parameter is not set or the session expires the parameter will not exist in the session - this means that your apllication has just been entered by the user.

${empty sessionScope['paramterName']} tells you if the paramter exist

${sessionScope['paramterName']} gives you the parameter value

If there is any other confusion - ask. I will give you ICQ# if needed.

So, before I start I will say.
Please have a look at the java docs.
I beleive that it will be much easier for you.

When you want to create a session you should use this:
<%request.getSession(true);%>
when you set the input prameter to true if the session do not exist or it is invlaidated a brand new session is created.

When you want to read a session varible use:
a/ <%request.getSession(true).getAttribute("attributeName");%>
b/ using the EL: ${sessionScope["attributeName"]}

When you want to add a session variable:
a/ <%request.getSession(true).setAttribute("attributeName", attributeValue)%>