Solved

Session check

Posted on 2004-04-18
4
220 Views
Last Modified: 2010-04-01
Hi Experts,

What I need is to find out if the JSP page opened first time within session or may be there is another way but without using URL string.

Thank you.
0
Comment
Question by:fpoyavo
  • 2
  • 2
4 Comments
 
LVL 1

Accepted Solution

by:
JNic earned 250 total points
ID: 10857882
Hi,

there are of course many ways you can do this.

Here is one way:

When your action-class has determined that the user has opened the page, you set a parameter:

HttpSession session=request.getSession();
session.setAttribute("didUserOpenPage1", "yes");

In the jsp:

<%
HttpSession session=request.getSession();
String didUserOpenPage1=session.getAttribute("didUserOpenPage1");
if(didUserOpenPage1.equals("yes"){
  System.out.println("OH NO! HE HAS OPENED THIS PAGE BEFORE!!!!!");

}
// here you know its the 1. time
%>
0
 
LVL 1

Author Comment

by:fpoyavo
ID: 10862395
:) Cool I will check this out.
0
 
LVL 1

Author Comment

by:fpoyavo
ID: 10884542
Thank you.
0
 
LVL 1

Expert Comment

by:JNic
ID: 10886212
My pleasure! Thanks for accepting! :)
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
jersey maven project error 7 145
nested if has else if 13 99
struts exact match support 3 61
JavaScript parse form with colon separated values 2 78
Facebook has became the #1 social media platform. People share many funny videos there, yet you don't know how to download them? Now you can download Videos from Facebook in just 3 simple steps.
The Windows functions GetTickCount and timeGetTime retrieve the number of milliseconds since the system was started. However, the value is stored in a DWORD, which means that it wraps around to zero every 49.7 days. This article shows how to solve t…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

726 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question