Connecting Tech Pros Worldwide Help | Site Map

Session detection JSP determing content?

Paks's Avatar
Newbie
 
Join Date: Dec 2006
Location: Stockholm, SWEDEN
Posts: 13
#1: Jun 12 '08
Hi there,
developing a web application and got a total mind block.

I'm using the frameworks hibernate, struts and spring.
And when you click on a link to a JSP-page, I want to redirect depending on the sessions value, which contains a User-object. Get a value from the object and depending on whether this value is null or not I want to redirect to different JSP-pages.

Does anyone know how to do this? In which layer should the controll be done?

The most annoying thing is that I've done a similar thing a couple years ago, but now I have no idea :/

Thankful for any help.

-- Paks
JosAH's Avatar
Expert
 
Join Date: Mar 2007
Posts: 10,611
#2: Jun 12 '08

re: Session detection JSP determing content?


Have a look at the Filter interface; they can intercept requests (and responses
in the 2.mumble specs) and redirect them to another page.

You have to implement that interface and declare in your xml file where that filter
is supposed to be located logically.

I haven't done anything with that web stuff since years so I can't help you any
further; sorry for that.

kind regards,

Jos
Needs Regular Fix
 
Join Date: Aug 2007
Posts: 283
#3: Jun 13 '08

re: Session detection JSP determing content?


Quote:

Originally Posted by Paks

Hi there,
developing a web application and got a total mind block.

I'm using the frameworks hibernate, struts and spring.
And when you click on a link to a JSP-page, I want to redirect depending on the sessions value, which contains a User-object. Get a value from the object and depending on whether this value is null or not I want to redirect to different JSP-pages.

Does anyone know how to do this? In which layer should the controll be done?

The most annoying thing is that I've done a similar thing a couple years ago, but now I have no idea :/

Thankful for any help.

-- Paks

As said by jos you need a Filter, In order to redirect depending upon session value you need to use HttpSessionListener, just google around to know about Filters and HttpSessionListeners.

cheers.

regards,

ajos
Paks's Avatar
Newbie
 
Join Date: Dec 2006
Location: Stockholm, SWEDEN
Posts: 13
#4: Jun 16 '08

re: Session detection JSP determing content?


Thanks for your help :)
The filters had completely slipped my mind, will look in to it right away!

-- Paks
Reply