You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Richard Sand <rs...@vgalleries.com> on 2001/06/25 15:33:49 UTC

bizarre page flushing situation

Hi all- I've got the following somewhat whacky setup which Tomcat refuses to
handle.  It involves custom tags and included JSP pages.  My tomcat is 3.2.2
on W2K running native (i.e. no external web server).

At the bottom of all of my JSP pages I include a JSP footer as follows:

<%@ include file="/footer.jsp" %>

Inside footer.jsp, I display a footer that is customized to whether the user
is logged in, which is determined by custom tags.  Footer.jsp looks as
follows:

<ipa:ifUserLoggedIn>
   <jsp:include page="/footers/logged_in.html" flush="true"/>
</ipa:ifUserLoggedIn>

<ipa:ifUserNotLoggedIn>
   <jsp:include page="/footers/not_logged_in.html" flush="true"/>
</ipa:ifUserNotLoggedIn>

So here's the problem: I get the exception:

 java.io.IOException: Illegal to flush within a custom tag

but ONLY when I use those particular custom tags inside the footer.  If I
use them in the main jsp pages they work fine.

I also tried removing the flush=true, but tomcat replies:

org.apache.jasper.compiler.CompileException: ... jsp:include needs to have
"flush=true"

On other application servers, I didn't have the flush=true and they worked
fine.

Lastly, the doAfterBody of the tags is very basic:

 try {
  // write the body and return SKIP_BODY
  bodyContent.writeOut(bodyContent.getEnclosingWriter());
  return SKIP_BODY;
 } catch (Exception e) {
  throw new JspException(e.toString());
 }


Can anyone explain this behavior???

Thanks for your help!

Best regards,

Richard


how to use jsp:include inside a custom tag?

Posted by Richard Sand <rs...@vgalleries.com>.
I want to do a jsp:include inside a custom tag, but Tomcat gives me:

java.io.IOException: Illegal to flush within a custom tag

My JSP is:

<ipa:ifUserLoggedIn>
   <jsp:include page="/footers/logged_in.html" flush="true"/>
</ipa:ifUserLoggedIn>

Is there another way to do this?  I have had this code running on other app
servers without any problems.  Is this a case of Tomcat more strictly
adhering to specs? Any help greatly appreciated!

Best regards,

Richard


Re: bizarre page flushing situation

Posted by Richard Sand <rs...@vgalleries.com>.
A simple distillation of my previous e-mail is:

Why won't tomcat let me do a "flush" inside a custom tag (other app servers
haven't complained).  I.e. I want to do a jsp:include inside a custom tag.

<ipa:ifUserLoggedIn>
   <jsp:include page="/footers/logged_in.html" flush="true"/>
</ipa:ifUserLoggedIn>

Any help greatly appreciated.

-Richard


----- Original Message -----
From: "Richard Sand" <rs...@vgalleries.com>
To: <to...@jakarta.apache.org>
Sent: Monday, June 25, 2001 3:33 PM
Subject: bizarre page flushing situation


> Hi all- I've got the following somewhat whacky setup which Tomcat refuses
to
> handle.  It involves custom tags and included JSP pages.  My tomcat is
3.2.2
> on W2K running native (i.e. no external web server).
>
> At the bottom of all of my JSP pages I include a JSP footer as follows:
>
> <%@ include file="/footer.jsp" %>
>
> Inside footer.jsp, I display a footer that is customized to whether the
user
> is logged in, which is determined by custom tags.  Footer.jsp looks as
> follows:
>
> <ipa:ifUserLoggedIn>
>    <jsp:include page="/footers/logged_in.html" flush="true"/>
> </ipa:ifUserLoggedIn>
>
> <ipa:ifUserNotLoggedIn>
>    <jsp:include page="/footers/not_logged_in.html" flush="true"/>
> </ipa:ifUserNotLoggedIn>
>
> So here's the problem: I get the exception:
>
>  java.io.IOException: Illegal to flush within a custom tag
>
> but ONLY when I use those particular custom tags inside the footer.  If I
> use them in the main jsp pages they work fine.
>
> I also tried removing the flush=true, but tomcat replies:
>
> org.apache.jasper.compiler.CompileException: ... jsp:include needs to have
> "flush=true"
>
> On other application servers, I didn't have the flush=true and they worked
> fine.
>
> Lastly, the doAfterBody of the tags is very basic:
>
>  try {
>   // write the body and return SKIP_BODY
>   bodyContent.writeOut(bodyContent.getEnclosingWriter());
>   return SKIP_BODY;
>  } catch (Exception e) {
>   throw new JspException(e.toString());
>  }
>
>
> Can anyone explain this behavior???
>
> Thanks for your help!
>
> Best regards,
>
> Richard
>
>