Hi Shailendra,
The problem is solved.
I was including 2 different jsps(header.jsp and comon.jsp). That was causing
the problem.
When I removed the first JSP, I was getting the login page and rest of the
page in a single page.
Instead of using <jsp:include page="/common.jsp" flush="true" />
I used <%@ include file="/common.jsp" %>
This seemed to have solved the problem. The only problem now is that I have
to get my pages recompiled if I make any changes in the common.jsp file.
Thanks
JS
-----Original Message-----
From: Shailendra [mailto:[EMAIL PROTECTED]]
Sent: Sunday, February 18, 2001 11:53 AM
To: [EMAIL PROTECTED]
Subject: Re: Using session
hi Jasbinder
is your problem is solved or you have findout where the problem is?
i am not an expert of jsp but i can say the problem where you are facing
problem is
redirection is only possible when you have not send anything to client(by
using flush or any mean)
in your case you are using flush=true when you are calling your common.jsp
so after that cammand you can't use redirection
ref:
homediectory of
javawebserver\doc\en\dynamic\jspages\jsp10\sepec\overview.fm.html#8140
shailendra
----- Original Message -----
From: Sachin S. Khanna <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Saturday, February 17, 2001 11:28 AM
Subject: Re: Using session
> Mr. Jasbinder Singh,
> In JSP's the session variable is implicitly available on every jsp
> page by default, unless the jsp have the following directive :
> <%@ page session = "false" %>
> Thats the reason for the behaviour that you are encountering.
> Assume the above you can reconsider the design of your application and
> logic.
> Have a nice day.
> With regards,
> Sachin S. Khanna.
> www.emailanorder.com
>
> ----- Original Message -----
> From: Singh, Jasbinder <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Saturday, February 17, 2001 4:48 AM
> Subject: Using session
>
>
> > Hi All,
> >
> > I am developing an application that requires secured login where the
page
> > should not be reached without logging.
> > I have a common jsp that has the following scriptlet and also includes
the
> > logo and other header information that has to be displayed.
> > common.jsp
> > <%
> > javax.servlet.http.HttpSession sess = request.getSession(false);
> > if ( sess.isNew() )
> > {
> > System.out.println("Session new");
> > response.sendRedirect("/login.jsp");
> > return;
> > }
> > else
> > System.out.println("Session not new");
> > if ( sess.getValue("user")==null )
> > {
> > System.out.println("userid is null");
> > response.sendRedirect("/login.jsp");
> > return;
> > }
> > %>
> >
> > I include this jsp in all my other JSP's as
> > <jsp:include page="/body.jsp" flush="true" />
> > When I try to invoke a page directly by typing the url, I get the above
> > println statements
> > correctly("Session new" and "userid is null"), the included common.jsp
> page
> > is not displayed but the rest of the page is displayed. The conrol
doesn't
> > go to the login.jsp. But when I invoke the common.jsp directly, the
> control
> > does go to the login.jsp page.
> >
> > Am I missing something ? Is this possible or I have to include a similar
> > scriptlet in every jsp that I write.
> >
> > Thanks in advance
> > JS
> >
> >
>
===========================================================================
> > 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
> >
>
>
===========================================================================
> 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
===========================================================================
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
===========================================================================
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