aspose file tools*
The moose likes Struts and the fly likes Session Error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Session Error" Watch "Session Error" New topic
Author

Session Error

shivam singhal
Ranch Hand

Joined: Jul 15, 2012
Posts: 226

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

Joined: Jan 10, 2002
Posts: 61221
    
  66

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


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
shivam singhal
Ranch Hand

Joined: Jul 15, 2012
Posts: 226

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

Joined: Jan 10, 2002
Posts: 61221
    
  66

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

Joined: Jul 15, 2012
Posts: 226

How filter is mapped to the very first client's request for the Home page?
shivam singhal
Ranch Hand

Joined: Jul 15, 2012
Posts: 226

sorry, got this,,

can we map filter after strut action class??
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61221
    
  66

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

Joined: Jul 15, 2012
Posts: 226

struts and servlets wouldn't work together???
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61221
    
  66

Bear Bibeault wrote:It may have its own means of accomplishing this.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Session Error