Solved

Session check

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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Spring Tuorial 1 107
ajax auto save 15 93
maven project import to eclipse problems 13 94
JSONSerializer.toJSON in JSP generating error 8 52
HOW TO: Install and Configure VMware vSphere Hypervisor 6.5 (ESXi 6.5), Step by Step Tutorial with screenshots. From Download, Checking Media, to Completed Installation.
Find out what Office 365 Transport Rules are, how they work and their limitations managing Office 365 signatures.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

708 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

16 Experts available now in Live!

Get 1:1 Help Now