Solved

Session check

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

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
love6 challenge java 31 133
doubleChar java challenge 7 106
How to Post an If Statement in JSP 3 56
oracle fusion vs MQ 2 116
Does your audience prefer people in photos or no people? How can you best highlight what you’re selling? What are your competitors doing, and what can you do that is different and unique from them?  Continue reading to learn how to make your images …
There’s a good reason for why it’s called a homepage – it closely resembles that of a physical house and the only real difference is that it’s online. Your website’s homepage is where people come to visit you. It’s the family room of your website wh…
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…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

831 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