*
The moose likes JSP and the fly likes jsp: include not working... Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "jsp: include not working..." Watch "jsp: include not working..." New topic
Author

jsp: include not working...

Timothy Sam
Ranch Hand

Joined: Sep 18, 2005
Posts: 746
Hi I have the following jsp files...

1. cpanel.jsp
2. adminmenubar.jsp
3. usermenubar.jsp
3. failed.jsp

I have a bean stored in a session scoped variable called userLoginFormBean.

now from the cpanel.jsp, I try to include adminmenubar.jsp or usermenubar.jsp



the above workes... now inside adminmenubar.jsp, I have the following code which checks if the attribute userId is empty or not... I do this to check if the user is still logged in or not...



I try to off the the webserver. This would destroy all my session scoped variable... From the rule in cpnel.jsp, if loginFormBean.groupId == 1 it will include adminmenubar.jsp and if not usermenubar.jsp. In my case, the usermenubar.jsp would be included... I have the same code in usermenubar.jsp similar to adminmenubar.jsp. It goes like this...



I should be redirected to the failed.jsp page... but I'm not... it keeps on showing cpanel.jsp but the includes are not included. Now... What I need to know if this should work under all circumstances? Can I redirect a page from an include file? Thanks!


SCJP 1.5
http://devpinoy.org/blogs/lamia/ - http://everypesocounts.com/
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60804
    
  65

No. Redirects are ignored in included resources.

This is the sort of thing (user authentication) that a servlet filter is perfect for. Then you don't need any goop on the pages to do any checking.
[ February 14, 2006: Message edited by: Bear Bibeault ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Timothy Sam
Ranch Hand

Joined: Sep 18, 2005
Posts: 746
DANG! Now that put a lot of question marks on my head... What is a servlet filter? Any good links for that? Thanks! I'm using JSTL and EL with struts by the way...
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60804
    
  65

http://java.sun.com/j2ee/sdk_1.3/techdocs/api/javax/servlet/Filter.html
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60804
    
  65

http://www.onjava.com/pub/a/onjava/2004/03/03/filters.html
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: jsp: include not working...
 
Similar Threads
Problem with HttpSession in Struts2
Help with JSTL usage
jspinclude with EL
Comparing variables using JSTL
Best way to find out of user is logged in