yes u can definitely keep the authentication part of code in a separate
JSP file and then include that file either static include or dynamic..
Static include:
<%@ include file="relativeURL" %>
The include directive inserts a file of text or code in a JSP file at
translation time, when the JSP file is compiled. The include process is
static. A static include means that the text of the included file is added
to the JSP file.
or dynamic include:
<jsp:include page="{ relativeURL | <%= expression %>} flush="true" />
The <jsp:include> tag allows you to include either a static or dynamic
file. A static file is parsed and its content included in the calling JSP
page. A dynamic file acts on the request and sends back a result that is
included in the JSP page.
I think this should help u...
Meghana.
On Tue, 16 Jan 2001, Deepak C S wrote:
> hi people,
>
> 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??
>
> pls help.
>
> Thanx in adv,
> Deeps
>
> ===========================================================================
> To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
> For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
> Some relevant FAQs on JSP/Servlets can be found at:
>
> http://java.sun.com/products/jsp/faq.html
> http://www.esperanto.org.nz/jsp/jspfaq.html
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
> http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets
>
******************************************************************************
We have no right to ask when sorrow comes, "Why did this happen to me?"
Unless we ask the same question for every moment of happiness that comes our
way.
===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
Some relevant FAQs on JSP/Servlets can be found at:
http://java.sun.com/products/jsp/faq.html
http://www.esperanto.org.nz/jsp/jspfaq.html
http://www.jguru.com/jguru/faq/faqpage.jsp?name=JSP
http://www.jguru.com/jguru/faq/faqpage.jsp?name=Servlets