Hi,
I posted this on struts mailing list but was adviced to post here as it might be a Tiles issue. I am trying to get TilesDecorationFilter (http://tiles.apache.org/tutorial/advanced/utils.html) to work with struts2.0.9 without any success. Can anyone please help me figure out where am I going wrong? I am not sure if this is a tiles list question or struts? Tiles is decorating jsps but not the out put from an action. If I access jsp/home.jsp it comes with the layout but home.action only prints layout and result of action is not seen anywhere. There are no errors. Kindly advice. web.xml <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5"> <display-name>MyApp</display-name> <listener> <listener-class> org.apache.struts2.tiles.StrutsTilesListener </listener-class> </listener> <filter> <filter-name>struts2</filter-name> <filter-class> org.apache.struts2.dispatcher.FilterDispatcher </filter-class> </filter> <filter> <filter-name>tilesdecoration</filter-name> <filter-class>org.apache.tiles.web.util.TilesDecorationFilter</filter-class> <init-param> <param-name>definition</param-name> <param-value>blank</param-value> </init-param> <init-param> <param-name>attribute-name</param-name> <param-value>body</param-value> </init-param> </filter> <filter-mapping> <filter-name>struts2</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <filter-mapping> <filter-name>tilesdecoration</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <welcome-file-list> <welcome-file>home.action</welcome-file> </welcome-file-list> </web-app> struts.xml <struts> <package name="default" extends="struts-default"> <result-types> <result-type class="org.apache.struts2.views.tiles.TilesResult" name="tiles"> </result-type> </result-types> <action name="home" class="com.tj.actions.HomeAction"> <result>jsp/home.jsp</result> </action> </package> </struts> tiles.xml <?xml version="1.0" encoding="ISO-8859-1" ?> <!DOCTYPE tiles-definitions PUBLIC "-//Apache Software Foundation//DTD Tiles Configuration 2.0//EN" "http://tiles.apache.org/dtds/tiles-config_2_0.dtd"> <tiles-definitions> <definition name="blank" template="/jsp/template/blankLayout.jsp"> <put-attribute name="title" value="my application" /> </definition> </tiles-definitions> blankLayout.jsp <%@ taglib uri="http://tiles.apache.org/tags-tiles" prefix="tiles" %> <html> <head> <title><tiles:getAsString name="title"/></title> </head> <body> <tiles:insertAttribute name="body" /> </body> </html> |
2007/11/7, Amit Rana <[hidden email]>:
> > Tiles is decorating jsps but not the out put from an action. > ... > <action name="home" class="com.tj.actions.HomeAction"> > <result>jsp/home.jsp</result> > </action> > Just to be sure, did you try to remove the TilesDecorationFilter and see if your action works? Antonio |
In reply to this post by Amit Rana
2007/11/7, Amit Rana <[hidden email]>:
> > Tiles is decorating jsps but not the out put from an action. > ... > <action name="home" class="com.tj.actions.HomeAction"> > <result>jsp/home.jsp</result> > </action> > >Just to be sure, did you try to remove the TilesDecorationFilter and see if >your action works? >Antonio Yes action works if I remove TilesDecorationFilter. Action also works if I reverse the order of filters i.e. below works <filter-mapping> <filter-name>struts2</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> <filter-mapping> <filter-name>tilesdecoration</filter-name> <url-pattern>/*</url-pattern> </filter-mapping> If I reverse the order then I can only see the layou and not the result of action. Any suggestions? |
2007/11/8, Amit Rana <[hidden email]>:
> > 2007/11/7, Amit Rana <[hidden email]>: > > > > Tiles is decorating jsps but not the out put from an action. > > ... > > <action name="home" class="com.tj.actions.HomeAction"> > > <result>jsp/home.jsp</result> > > </action> > > > >Just to be sure, did you try to remove the TilesDecorationFilter and see > if > >your action works? > > >Antonio > Yes action works if I remove TilesDecorationFilter. > > Action also works if I reverse the order of filters i.e. below works > > <filter-mapping> > <filter-name>struts2</filter-name> > <url-pattern>/*</url-pattern> > </filter-mapping> > <filter-mapping> > <filter-name>tilesdecoration</filter-name> > <url-pattern>/*</url-pattern> > </filter-mapping> > > If I reverse the order then I can only see the layou and not the > result of action. > > Any suggestions? Yes, I've seen the code and it seems like a bug :-( It seems that the filter chain is invoked in a strange way... Can you create a JIRA ticket, please? https://issues.apache.org/struts/browse/TILES Thanks Antonio P.S.: If you want my opinion in decoration, I think Sitemesh is definitely better: http://www.opensymphony.com/sitemesh/ And nothing prevents you from using it together with Tiles, both in the decoration pages and in pages-to-be-decorated. |
On 11/8/07, Antonio Petrelli <[hidden email]> wrote:
> Yes, I've seen the code and it seems like a bug :-( It seems that the filter > chain is invoked in a strange way... > Can you create a JIRA ticket, please? Created, https://issues.apache.org/struts/browse/TILES-228 > P.S.: If you want my opinion in decoration, I think Sitemesh is definitely > better: > http://www.opensymphony.com/sitemesh/ > And nothing prevents you from using it together with Tiles, both in the > decoration pages and in pages-to-be-decorated. I will try that now. Thaks. |
Free forum by Nabble | Edit this page |