Solved

Session check

Posted on 2004-04-18
4
219 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: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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
method inner class 6 83
Best practices to work on a spring MVC project 1 126
withoutString  challenge 40 208
print map entry 34 72
This article explains the steps required to use the default Photos screensaver to display branding/corporate images
Many businesses neglect disaster recovery and treat it as an after-thought. I can tell you first hand that data will be lost, hard drives die, servers will be hacked, and careless (or malicious) employees can ruin your data.
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

860 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