You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by "Williams, Erskine BGI SF" <Er...@barclaysglobal.com> on 2003/04/25 19:41:53 UTC

determining the order of custom tag execution

I'm running Tomcat4.1.18 on Win2KPro; Struts 1.1-b2; JDK 1.4.1_02

I have a custom jsp tag I've written to enforce our security model. I want
to insert it into my struts tiles layout page, so that any page that's built
with this layout runs my security check first via the tag. The tag itself
will do a response.sendRedirect() to a page informing the user they are not
authorized to view the protected resource if a session scoped attribute is
deemed not to convey the appropriate permissions to view the resource
protected by my tag.

The problem I'm having is that even though my tag is the first thing on my
jsp tiles layout page, I'm getting an error when the security tag tries to
redirect: "Cannot forward after response has been committed" This suggests
that subsequent parts of my tiles layout page are being evaluated and sent
to the browser before the redirect occurs in my custom security tag. This is
surprising, since my security tag is the first thing on the page, and I
would expect it to evaluate and do the redirect before anything gets sent to
the browser. 

My question is, can anyone explain how to ensure that my custom tag
evaluates first on a jsp page, and that no other content gets flushed to the
buffer before my tag decides to redirect? I've tried explicitly setting the
tiles "flush" attribute to false.  

My security tag works as advertised if it is the only tag on a jsp page or
even with struts html tags, but it just seems to break when there are struts
tiles tags involved. Perhaps it is more of a tiles issue.

Any advice is much appreciated,
Erskine

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org