I have a problem using logic:redirect with tiles.

If I put the redirect tag into the page which inserts
a tile definition then the redirect works. For
example:

(in my tiles-defs.xml):

<definition name="mainLayout"
path="/tiles/mainLayout.jsp">
  <put name="pageMenu"
value="/common/defaultMenu.jsp"></put>
  <put name="pageBody"
value="/common/blankBody.jsp"></put>
</definition>


/main.jsp:

...
<%@ taglib uri="http://struts.apache.org/tags-tiles";
prefix="tiles" %>
<%@ taglib uri="http://struts.apache.org/tags-logic";
prefix="logic" %>
...
<%@ page contentType="text/html;charset=UTF-8"
pageEncoding="UTF-8" language="java" %>

<tiles:insert definition="mainLayout" flush="true">
  <tiles:put name="pageBody" type="String">
    <!-- check userData bean is present otherwise they
need to log-in -->
    <logic:empty name="userData">
      <logic:redirect action="login" />
    </logic:empty>
    ...
    blah blah some html and tags
    ...
  </tiles:put>
</tiles:insert>

The above redirect works fine. The problem is that if
I try to put a logic:redirect into the tile definition
jsp or a jsp that gets included using a <tiles:insert
attribute="..."> tag my redirect gets ignored. I get
no exception message but the html for the jsp stops at
the <logic:redirect> tag.


Examples of a redirect that fails:


in jsp /tiles/mainLayout.jsp:

...
<%@ taglib uri="http://struts.apache.org/tags-tiles";
prefix="tiles" %>
<%@ taglib uri="http://struts.apache.org/tags-logic";
prefix="logic" %>
...
<%@ page contentType="text/html;charset=UTF-8"
pageEncoding="UTF-8" language="java" %>

<!-- *** THIS REDIRECT FAILS, I GET A BLANK JSP WITH
THE SOURCE SHOWING ONLY THIS COMMENT *** -->
<logic:empty name="userData">
  <logic:redirect action="login" />
</logic:empty>
<html:html>
    <head>
        ...
        <meta http-equiv="Content-Type"
content="text/html; charset=UTF-8">
    </head>

    <body>
        ...
        <tiles:insert attribute="pageMenu"/> 
        ...
        <tiles:insert attribute="pageBody"/>
        ... 
    </body>
</html:html>


also if I put a redirect into a jsp that gets inserted
as "pageBody" this fails and the body html stops at
the position of the logic:redirect tag.

Any ideas?


System info:

O.S.: Windows XP

struts version: 1.2.4

server: weblogic 8.1 sp3

Let me know if you need more info, thanks a lot.

Paul Moody


                
___________________________________________________________ 
How much free photo storage do you get? Store your holiday 
snaps for FREE with Yahoo! Photos http://uk.photos.yahoo.com

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to