tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Wentzel <Michael.Went...@aswethink.com>
Subject RE: please Help --session check
Date Tue, 16 Jan 2001 12:57:42 GMT
> 	As a part of authentication check, I am checking for a session
> attribute to validate user login across pages.
> eg:
> 
> if (session.getAttr("user")==null){
> sendRedirect(loginpage);
> }
> 
> But now, I am keeping these lines in all my jsp files(cut and 
> paste)..If I
> have to change somethg with that I need to change in all jsp pages..
> 
> Is there any better way than this?? like keeping session 
> -checking code in
> seperate file and including in all pages??

Yes, you can put all your common code in a separate file, say common.jsp,
and then include the following on all your pages:

<%@ include file="common.jsp" %>

You can also have multiple @include tags on a single page so you could
split up a file if need be.


---
Michael Wentzel
Software Developer
<A HREF="http://www.aswethink.com">Software As We Think</A>
<A HREF="mailto://wentzel@aswethink.com">Michael Wentzel</A>

Mime
View raw message