Solved

Session check

Posted on 2004-04-18
4
217 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Cloud-based technologies and services will continue to grow in popularity in 2017 thanks to the simple, scalable and cost-effective solutions they deliver. Here are three areas where cloud adoption is poised to really take off.
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Need to grow your business through quality cloud solutions? With everything required to build a cloud platform and solution, you may feel like the distance between you and the cloud is quite long. Help is here. Spend some time learning about the Con…

914 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now