You need to point the location property of each Result annotation to the tile definition you want to display not the actual page e.g.
@Results({ @Result(name = "input", location = "bLogin", type = "tiles"), @Result(name = "error", location = "bLogin", type = "tiles"), @Result(name = "success", location = "main", type = "tiles") }) <tiles-definitions> <definition name="template" template="/jsp/myTemplate.jsp" > <put-attribute name="title" value="myTest" /> <put-attribute name="header" value="/jsp/header.jsp" /> <put-attribute name="page" value="/jsp/defaultContentPage.jsp" /> <put-attribute name="footer" value="/jsp/footer.jsp" /> </definition> <definition name="bLogin" extends="template"> <put-attribute name="title" value="Login" /> <put-attribute name="page" value="/jsp/bLogin.jsp"/> </definition> <definition name="main" extends="template"> ... </definition> </tiles-definitions> See how you go. Peter. Nils P. wrote: > > Integrating Tiles 2 by using Struts 2 Annotations > > > > Hi Everybody, > > I'm using Spring 3 and Struts 2.1.8 (with the convention plugin) in my > project and have tried to embed jsp's related to either of them by using > tiles 2.2.1. > With Spring it works out great, but not with Struts. I tried some > suggestions from the internet, but none result in success. > > My Struts 2 action classes are controlled by annotations and are not > configured by the struts.xml. > There is rather just the struts-default.xml included in struts2-core.jar > extended by some information to make it known the tiles result type. > > <result-type name="tiles" > class="org.apache.struts2.views.tiles.TilesResult" /> > > Additionally I also added the StrutsTilesListener to my web.xml. > For example using the above described result type as an attribute for my > @Result Annotation > > @Results({ > @Result(name = "input", location = "/jsp/bLogin.jsp", type = > "tiles"), > @Result(name = "error", location = "/jsp/bLogin.jsp", type = > "tiles"), > @Result(name = "success", location = "/jsp/main.jsp", type = > "tiles") }) > public class BLogin extends ActionSupport implements Preparable, > SessionAware { > ... > > My tiles.xml looks (simplified) like > > <tiles-definitions> > <definition name="template" template="/jsp/myTemplate.jsp"> > <put-attribute name="title" value="myTest" /> > <put-attribute name="header" value="/jsp/header.jsp" /> > <put-attribute name="page" value="/jsp/defaultContentPage.jsp" > /> > <put-attribute name="footer" value="/jsp/footer.jsp" /> > </definition> > <definition name="bLogin" extends="template"> > <put-attribute name="title" value="Login" /> > <put-attribute name="page" value="/jsp/bLogin.jsp"/> > </definition> > </tiles-definitions> > > Unfortunately this just results in nothing. I dont get any error, but my > Struts pages are always shown as a whole page and not as the body part of > the tiles template. > > I think I haven't fully understand some of the related comcepts but I also > dont know where and how to find out more. > So, is there actually any solution to use tiles for my pages by > using/adapting just the annotations as well as the configurations in > tiles.xml and web.xml? > And if so, how? :) > > Best Regards. > -- View this message in context: http://old.nabble.com/Integrating-Tiles-2-by-using-Struts-2-Annotations-tp28364409p28364418.html Sent from the Struts - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org