Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Session Error

 
shivam singhal
Ranch Hand
Posts: 231
Java Notepad Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all,
I am developing a web-site,in which client have to log in,, after recognisation of correct user i have created a session..

ERROR : Now i am opening new tab in the same browser, and my web page allows another user to log-in?

I WANT : when new tab is open in the same browser where a user is already loggedin, the new page in new tab gets redirected to the logged in user's profile page..

REMEDY : I have tried to use scriptlets in my Home page, and validate if session does not exists, then open Home page , else connect with data base and open valid user's profile page... Still its not working..

ANY IDEA To Solve The Issue?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65111
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Filters. You should never put scriptlets on a JSP page.
 
shivam singhal
Ranch Hand
Posts: 231
Java Notepad Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
oks,,

"You should never put scriptlets on a JSP page."

Yeah , i know that, but don' know the reason behind "never put scriptlets"..
can you please tell me?
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65111
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
They were obsoleted over 12 years ago. It's like putting vacuum tubes in your TV.

This is the sort of thing what should not only be done in a Java class, but in a filter. Otherwise you need to put it into every servlet and JSP to check up front.
 
shivam singhal
Ranch Hand
Posts: 231
Java Notepad Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How filter is mapped to the very first client's request for the Home page?
 
shivam singhal
Ranch Hand
Posts: 231
Java Notepad Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry, got this,,

can we map filter after strut action class??
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65111
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You should have mentioned you were using Struts at the outset. It may have its own means of accomplishing this.

This post has been moved to the Struts forum.
 
shivam singhal
Ranch Hand
Posts: 231
Java Notepad Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
struts and servlets wouldn't work together???
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 65111
89
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Bear Bibeault wrote:It may have its own means of accomplishing this.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic