tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Anand Prasad <apra...@calient.net>
Subject RE: Exception thrown when Forwarding
Date Fri, 13 Oct 2000 17:53:16 GMT
Bragg,

I am including the page, which forwards to another page.  What is the best
solution you recommend.  

When I include the page  shall I go and ahead set FLUSH = "false"  in the
include tag  

I would definitely like to write this order which avoids me changing the
security options in many places

///Have a file security.jsp 
       which checks whether the user has logged in or not   and based onit
it forwards to another page

Include this page in all my jsp pages.

Your Ideas and help is appreciated.

Thanks
--Anand


-----Original Message-----
From: Bragg, Casey [mailto:Casey.Bragg@allegiancetelecom.com]
Sent: Friday, October 13, 2000 8:02 AM
To: 'tomcat-user@jakarta.apache.org'
Subject: RE: Exception thrown when Forwarding


Your JspWriter buffer 'out' appears to already have been flushed to the
client.  I had this problem when I used the <jsp:forward> tag after I used
the <jsp:include> tag which automatically flushes 'out'.  

As mentioned in another reply, 'out' is also flushed when its buffer is
full.

Of course, if your code contains out.flush() at any point prior to the
<jsp:forward> tag... well.. you know what that does...

...Casey

-----Original Message-----
From: Anand Prasad [mailto:axprasad@hotmail.com]
Sent: Thursday, October 12, 2000 6:40 PM
To: tomcat-user@jakarta.apache.org
Subject: Exception thrown when Forwarding


Hi

I store a session variable and basically check in every page whether that 
varibale contains any value.

When the user directly wants to enter the url without logging, I would like 
to redirect him to login page.

Here is code snippet.
//
<% if((String)session.getValue("loginId")==null){ %>
      <jsp:forward page="/login.htm" />
<% } %>

It throws up an exception in apache and tomcat.

I think I am making very stupid mistake...but unable to figure it.

Any suggestions, Thanks

javax.servlet.ServletException: Cannot forward as OutputStream or Writer has

already been obtained
        at java.lang.Throwable.fillInStackTrace(Native Method)
        at java.lang.Throwable.fillInStackTrace(Compiled Code)
        at java.lang.Throwable.(Compiled Code)
        at java.lang.Exception.(Compiled Code)
        at javax.servlet.ServletException.(ServletException.java:161)
        at 
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImp
l.java:386)
        at 
dv._0002fdv_0002fsecurity_0002ejspsecurity_jsp_2._jspService(_0002fdv_0002fs
ecurity_0002ejspsecurity_jsp_2.java:92)
        at 
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:126)
        at javax.servlet.http.HttpServlet.service(Compiled Code)
        at 
org.apache.jasper.runtime.JspServlet$JspServletWrapper.service(JspServlet.ja
va:174)
        at org.apache.jasper.runtime.JspServlet.serviceJspFile(Compiled 
Code)
        at org.apache.jasper.runtime.JspServlet.service(Compiled Code)
        at javax.servlet.http.HttpServlet.service(Compiled Code)
        at org.apache.tomcat.core.ServletWrapper.handleRequest(Compiled 
Code)
        at 
org.apache.tomcat.core.RequestDispatcherImpl.include(RequestDispatcherImpl.j
ava:262)
        at org.apache.jasper.runtime.PageContextImpl.include(Compiled Code)
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.

Share information about yourself, create your own public profile at 
http://profiles.msn.com.

Mime
View raw message