Ok... Assuming you have a tiles layout definition like:
<definition name=".basic.layout" path="/common/mainLayout.jsp"> <put name="header" value="/common/headerTile.jsp" /> <put name="content" value="" /> <put name="footer" value="/common/footerTile.jsp" /> </definition> You can make the header content a tile definition by itself, and use that definition to declare your Controller class, which will be the one with the logic for forwarding: <definition name=".basic.layout" path="/common/mainLayout.jsp"> <put name="header" value=".basic.layout.header" /> <put name="content" value="" /> <put name="footer" value="/common/footerTile.jsp" /> </definition> <definition name=".basic.layout.header" page="/common/headerTile.jsp" controllerClass="my.package.HeaderController"> </definition> And put the forward inside the HeaderController class: public void execute(ComponentContext tileContext, HttpServletRequest request, HttpServletResponse response, ServletContext servletContext) throws Exception { HttpSession session = request.getSession(false); if(null == session || null == session.getAttribute("loginForm")) { response.sendRedirect("/index.jsp"); } } Also, make sure that your '/common/mainLayout.jsp' page doesn't have any html code before the <tiles:insert attribute="header" /> invocation, or it will make a response being sent to the client. Regards. On 9/1/05, 梁炳場 <[EMAIL PROTECTED]> wrote: > > What if the Tiles layout composing header, menu and body. > > Where the Tiles Controller belongs to? > Does it stick one layout? > > Thanks > > 2005/9/1, Guillermo Castro <[EMAIL PROTECTED]>: > > The error happens when part of your jsp page has already been sent to > the > > client. > > > > My recommendation would be to define a Tiles Controller (see > > org.apache.struts.tiles.ControllerSupport) that would do the forwarding > > logic. > > > > I hope this helps. > > > > On 9/1/05, 梁炳場 <[EMAIL PROTECTED]> wrote: > > > > > > Within a Tiles layout, > > > I try to forward to another jsp when a bean not exist? > > > > > > But it leads to the subject line error message? > > > > > > In the header layout jsp, I put this > > > > > > <logic:notPresent scope="session" name="loginForm"> > > > <jsp:forward page="/index.jsp"/> > > > </logic:notPresent> > > > > > > If it is not allowed or it is not a good way, > > > what is the better way or another way to do so? > > > > > > Thanks > > > PC Leung > > > > > > --------------------------------------------------------------------- > > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > > > -- > > Guillermo Castro [EMAIL PROTECTED] > > Monterrey NL, Mexico http://www.javageek.org/ > > > > > -- Guillermo Castro [EMAIL PROTECTED] Monterrey NL, Mexico http://www.javageek.org/