Hi,
I think this is the expected result. In fact the follow line:

> *<@s.action var="dateAction" name="date" namespace="/"
> executeResult="true" />*
>
> initializes a dateAction reference (var) to the invoked action.
If you want to see your date you need to add this row
<@s.property value="#dateAction.date" />

Did it work in that way before?

Maurizio Cucchiara


2010/10/3 Derrick Koes <derrick_k...@skillsoft.com>

>  I am upgrading to struts 2.2.1, but realized there is an issue with
> freemarker sitemesh decorators which use the struts 2 action tag.  This is a
> regression from 2.1.8.1.
>
>
>
> To demonstrate the issue with a reasonably simple example I deployed the
> struts2-showcase-2.2.1 sample application.
>
>
>
> Then, ensuring the web.xml is set up to handle freemarker sitemesh
> decorators, I created a ‘main.ftl’ decorator based on the main.jsp decorator
> included in the app.  I modified the decorators.xml to use the main.ftl
> rather than the main.jsp decorator and restarted the app.  Note that the
> “date” action in the action tag within the freemarker sitemesh decorator
> runs as the variable usage for the year in the copyright line is correct.
> However, notice that the header is missing the date (as compared to the jsp
> version).
>
>
>
> Any help in further understanding or resolving the issue is appreciated.
>
>
>
> Below are the relevant files inlined (also attached).
>
>
>
> web.xml:
>
>
>
> *<?xml version="1.0" encoding="UTF-8"?>*
>
> *<web-app id="WebApp_9" version="2.4" *
>
> *                xmlns="http://java.sun.com/xml/ns/j2ee"; *
>
> *                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; *
>
> *                xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
> http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd";>*
>
> * *
>
> *    <display-name>Struts Showcase Application</display-name>*
>
> *                *
>
> *    <filter>*
>
> *        <filter-name>struts-prepare</filter-name>*
>
> *
> <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareFilter</filter-class>
> *
>
> *        <init-param>*
>
> *                <param-name>actionPackages</param-name>*
>
> *
> <param-value>org.apache.struts2.showcase.person</param-value>*
>
> *        </init-param>*
>
> *    </filter>*
>
> * *
>
> *    <filter>*
>
> *        <filter-name>struts-execute</filter-name>*
>
> *
> <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsExecuteFilter</filter-class>
> *
>
> *    </filter>*
>
> * *
>
> * *
>
> *   <filter>*
>
> *       <filter-name>sitemesh</filter-name>*
>
> *
> <filter-class>com.opensymphony.sitemesh.webapp.SiteMeshFilter</filter-class>
> *
>
> *   </filter>*
>
> * *
>
> *    <filter-mapping>*
>
> *        <filter-name>struts-prepare</filter-name>*
>
> *        <url-pattern>/*</url-pattern>*
>
> *    </filter-mapping>*
>
> * *
>
> *    <filter-mapping>*
>
> *        <filter-name>sitemesh</filter-name>*
>
> *        <url-pattern>/*</url-pattern>*
>
> *    </filter-mapping>*
>
> * *
>
> *    <filter-mapping>*
>
> *        <filter-name>struts-execute</filter-name>*
>
> *        <url-pattern>/*</url-pattern>*
>
> *    </filter-mapping>*
>
> * *
>
> *    <listener>*
>
> *
> <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
> *
>
> *    </listener>*
>
> *                *
>
> *    <listener>*
>
> *        <listener-class>*
>
> *          org.apache.myfaces.webapp.StartupServletContextListener*
>
> *        </listener-class>*
>
> *    </listener>*
>
> * *
>
> *    <listener>*
>
> *        <listener-class>*
>
> *            org.apache.struts2.tiles.StrutsTilesListener*
>
> *        </listener-class>*
>
> *    </listener>*
>
> *    *
>
> *    <!-- Chat Example in Showcase -->*
>
> *    <listener>*
>
> *                <listener-class>*
>
> *                  org.apache.struts2.showcase.chat.ChatSessionListener*
>
> *                </listener-class>*
>
> *    </listener>*
>
> * *
>
> *    <listener>*
>
> *
> <listener-class>org.apache.struts2.dispatcher.ng.listener.StrutsListener</listener-class>
> *
>
> *    </listener>*
>
> *                *
>
> *    <!-- SNIPPET START: dwr -->*
>
> * *
>
> *    <servlet>*
>
> *        <servlet-name>dwr</servlet-name>*
>
> *        <servlet-class>uk.ltd.getahead.dwr.DWRServlet</servlet-class>*
>
> *        <init-param>*
>
> *            <param-name>debug</param-name>*
>
> *            <param-value>true</param-value>*
>
> *        </init-param>*
>
> *    </servlet>*
>
> *                *
>
> *                <!-- JavaServer Faces Servlet Configuration, not used
> directly -->*
>
> *                <servlet>*
>
> *                <servlet-name>faces</servlet-name>*
>
> *
> <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>*
>
> *                <load-on-startup>1</load-on-startup>*
>
> *                </servlet>*
>
> *                                <servlet>*
>
> *                <servlet-name>JspSupportServlet</servlet-name>*
>
> *
> <servlet-class>org.apache.struts2.views.JspSupportServlet</servlet-class>*
>
> *                <load-on-startup>1</load-on-startup>*
>
> *                </servlet>*
>
> * *
>
> *      <!-- Sitemesh Freemarker and Velocity Decorator Servlets. Shares
> configuration with Struts.-->*
>
> *    <servlet>*
>
> *        <servlet-name>sitemesh-freemarker</servlet-name>*
>
> *
> <servlet-class>org.apache.struts2.sitemesh.FreemarkerDecoratorServlet</servlet-class>
> *
>
> *        <init-param>*
>
> *            <param-name>default_encoding</param-name>*
>
> *            <param-value>UTF-8</param-value>*
>
> *        </init-param>*
>
> *        <load-on-startup>1</load-on-startup>*
>
> *    </servlet>*
>
> * *
>
> *    <servlet>*
>
> *        <servlet-name>sitemesh-velocity</servlet-name>*
>
> *
> <servlet-class>org.apache.struts2.sitemesh.VelocityDecoratorServlet</servlet-class>
> *
>
> *        <init-param>*
>
> *            <param-name>default_encoding</param-name>*
>
> *            <param-value>UTF-8</param-value>*
>
> *        </init-param>*
>
> *        <load-on-startup>1</load-on-startup>*
>
> *    </servlet>*
>
> * *
>
> * *
>
> *                <!-- JavaServer Faces Servlet Mapping, not called
> directly -->*
>
> *    <servlet-mapping>*
>
> *        <servlet-name>faces</servlet-name>*
>
> *        <url-pattern>*.action</url-pattern>*
>
> *                </servlet-mapping>*
>
> * *
>
> *    <servlet-mapping>*
>
> *        <servlet-name>dwr</servlet-name>*
>
> *        <url-pattern>/dwr/*</url-pattern>*
>
> *    </servlet-mapping>*
>
> * *
>
> *    <servlet-mapping>*
>
> *        <servlet-name>sitemesh-freemarker</servlet-name>*
>
> *        <url-pattern>*.ftl</url-pattern>*
>
> *    </servlet-mapping>*
>
> * *
>
> *    <servlet-mapping>*
>
> *        <servlet-name>sitemesh-velocity</servlet-name>*
>
> *        <url-pattern>*.vm</url-pattern>*
>
> *    </servlet-mapping>*
>
> * *
>
> *    <!-- END SNIPPET: dwr -->*
>
> * *
>
> *    <!-- SNIPPET START: example.velocity.filter.chain*
>
> *        <filter>*
>
> *            <filter-name>struts-cleanup</filter-name>*
>
> *
> <filter-class>org.apache.struts2.dispatcher.ActionContextCleanUp</filter-class>
> *
>
> *        </filter>*
>
> *        <filter>*
>
> *            <filter-name>sitemesh</filter-name>*
>
> *
> <filter-class>org.apache.struts2.sitemesh.VelocityPageFilter</filter-class>
> *
>
> *        </filter>*
>
> *        <filter>*
>
> *            <filter-name>struts</filter-name>*
>
> *
> <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
> *
>
> *        </filter>*
>
> * *
>
> *        <filter-mapping>*
>
> *            <filter-name>struts-cleanup</filter-name>*
>
> *            <url-pattern>/*</url-pattern>*
>
> *        </filter-mapping>*
>
> *        <filter-mapping>*
>
> *            <filter-name>sitemesh</filter-name>*
>
> *            <url-pattern>/*</url-pattern>*
>
> *        </filter-mapping>*
>
> *        <filter-mapping>*
>
> *            <filter-name>struts</filter-name>*
>
> *            <url-pattern>/*</url-pattern>*
>
> *        </filter-mapping>*
>
> *    END SNIPPET: example.velocity.filter.chain -->*
>
> * *
>
> *    <!-- SNIPPET START: example.freemarker.filter.chain*
>
> *    <filter>*
>
> *        <filter-name>struts-cleanup</filter-name>*
>
> *
> <filter-class>org.apache.struts2.dispatcher.ActionContextCleanUp</filter-class>
> *
>
> *    </filter>*
>
> *    <filter>*
>
> *        <filter-name>sitemesh</filter-name>*
>
> *
> <filter-class>org.apache.struts2.sitemesh.FreeMarkerPageFilter</filter-class>
> *
>
> *    </filter>*
>
> *    <filter>*
>
> *        <filter-name>struts</filter-name>*
>
> *
> <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
> *
>
> *    </filter>*
>
> * *
>
> *    <filter-mapping>*
>
> *        <filter-name>struts-cleanup</filter-name>*
>
> *        <url-pattern>/*</url-pattern>*
>
> *    </filter-mapping>*
>
> *    <filter-mapping>*
>
> *        <filter-name>sitemesh</filter-name>*
>
> *        <url-pattern>/*</url-pattern>*
>
> *    </filter-mapping>*
>
> *    <filter-mapping>*
>
> *        <filter-name>struts</filter-name>*
>
> *        <url-pattern>/*</url-pattern>*
>
> *    </filter-mapping>*
>
> *    END SNIPPET: example.freemarker.filter.chain -->*
>
> * *
>
> *    <welcome-file-list>*
>
> *        <welcome-file>index.jsp</welcome-file>*
>
> *        <welcome-file>default.jsp</welcome-file>*
>
> *        <welcome-file>index.html</welcome-file>*
>
> *    </welcome-file-list>*
>
> * *
>
> *</web-app>*
>
>
>
>
>
> decorators.xml:
>
>
>
> *<?xml version="1.0" encoding="ISO-8859-1"?>*
>
> * *
>
> *<decorators defaultdir="/WEB-INF/decorators">*
>
> *    <!-- Any urls that are excluded will never be decorated by Sitemesh
> -->*
>
> *    <excludes>*
>
> *        <pattern>/debug.jsp</pattern>*
>
> *        <pattern>/styles/*</pattern>*
>
> *        <pattern>/scripts/*</pattern>*
>
> *        <pattern>/images/*</pattern>*
>
> *        <pattern>/dojo/*</pattern>*
>
> *        <pattern>/struts/*</pattern>*
>
> *        <pattern>/ajax/AjaxResult*</pattern>*
>
> *        <pattern>/AjaxTest.action</pattern>*
>
> *        <pattern>/ajax/remoteforms/AjaxRemoteForm.action</pattern>*
>
> *        <pattern>/tags/ui/ajax/*</pattern>*
>
> *        <pattern>/chat/ajax/*</pattern>*
>
> *        <pattern>/hangman/ajax/*</pattern>*
>
> *        <pattern>/nodecorate/*</pattern>*
>
> *    </excludes>*
>
> * *
>
> *    <decorator name="main" page="main.ftl">*
>
> *        <pattern>/*</pattern>*
>
> *    </decorator>*
>
> *    <!--<decorator name="panel" page="panel.jsp"/>-->*
>
> *    <!--<decorator name="dashedBox" page="dashedBox.jsp"/>-->*
>
> *    <!--<decorator name="printable" page="printable.jsp"/>-->*
>
> *</decorators>*
>
>
>
>
>
> main.ftl decorator:
>
>
>
> *<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 Transitional//EN"*
>
> *"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";>*
>
> * *
>
> *<html xmlns="http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en">*
>
> *<head>*
>
> *    <title>${title}</title>*
>
> *    <link href="<@s.url value='/styles/main.css' encode='false'
> includeParams='none'/>" rel="stylesheet" type="text/css" media="all"/>*
>
> *    ${head}*
>
> *</head>*
>
> * *
>
> *<body id="page-home">*
>
> * *
>
> * *
>
> *<div id="page">*
>
> *    <div id="outer-header">*
>
> *        <div id="header" class="clearfix">*
>
> *            <div id="branding">*
>
> *                <h1 class="title">Struts Showcase</h1>*
>
> *                <@s.action var="dateAction" name="date" namespace="/"
> executeResult="true" />*
>
> *            </div><!-- end branding -->*
>
> * *
>
> *            <div id="search">*
>
> *                <img src="<@s.url value='/images/struts-power.gif'
> encode='false' includeParams='none'/>" alt="Powered by Struts"/>*
>
> *            </div><!-- end search -->*
>
> * *
>
> *            <hr/>*
>
> *            <div style="clear: both;"></div>*
>
> *        </div>*
>
> *    </div><!-- end header -->*
>
> * *
>
> *    <div id="content" class="clearfix">*
>
> *        <div id="nav">*
>
> *            <div class="wrapper">*
>
> *                <h2 class="accessibility">Navigation</h2>*
>
> *                <ul class="clearfix">*
>
> *                    <li><@s.a value="/showcase.jsp">Home</@s.a></li>*
>
> *                    <li><@s.a value="/ajax/index.jsp">Ajax</@s.a></li>*
>
> *                    <li><@s.a value="/chat/index.jsp">Ajax
> Chat</@s.a></li>*
>
> *                    <li><@s.a action="actionChain1!input"
> namespace="/actionchaining"  includeParams="none">Action
> Chaining</@s.a></li>*
>
> *                    <li><@s.a action="index" namespace="/config-browser"
> includeParams="none">Config Browser</@s.a></li>*
>
> *                    <li><@s.a
> value="/conversion/index.jsp">Conversion</@s.a></li>*
>
> *                    <li><@s.a
> value="/empmanager/index.jsp">CRUD</@s.a></li>*
>
> *                    <li><@s.a value="/wait/index.jsp">Execute &
> Wait</@s.a></li>*
>
> *                    <li><@s.a value="/filedownload/index.jsp">File
> Download</@s.a></li>*
>
> *                    <li><@s.a value="/fileupload/index.jsp">File
> Upload</@s.a></li>*
>
> *                    <li><@s.a
> value="/freemarker/index.jsp">Freemarker</@s.a></li>*
>
> *                    <li><@s.a action="hangmanMenu"
> namespace="/hangman">Hangman</@s.a></li>*
>
> *                    <li><@s.a value="/jsf/index.jsp">JavaServer
> Faces</@s.a></li>*
>
> *                    <li><@s.a value="/tags/index.jsp">Tags</@s.a></li>*
>
> *                    <li><@s.a
> value="/tiles/index.action">Tiles</@s.a></li>*
>
> *                    <li><@s.a value="/token/index.jsp">Token</@s.a></li>*
>
> *                    <li><@s.a
> value="/validation/index.jsp">Validation</@s.a></li>*
>
> *                    <li><@s.a value="/interactive/index.jsp">Interactive
> Demo</@s.a></li>*
>
> *                    <li><@s.a value="/person/index.jsp">Person
> Manager</@s.a></li>*
>
> *                    <li><@s.a value="/integration/editGangster">Struts 1
> Integration</@s.a></li>*
>
> *                    <li class="last"><@s.a
> value="/help.jsp">Help</@s.a></li>*
>
> *                </ul>*
>
> *            </div>*
>
> *            <hr/>*
>
> * *
>
> *        </div><!-- end nav -->*
>
> * *
>
> *        ${body}*
>
> *        *
>
> *    </div><!-- end content -->*
>
> * *
>
> *    <div id="footer" class="clearfix">*
>
> *        <p>Copyright &copy; 2003-<@s.property value="#dateAction.now.year
> + 1900" /> The Apache Software Foundation.</p>*
>
> *        <@s.hidden name="project-name" value="Struts 2" />*
>
> *    </div><!-- end footer -->*
>
> *    <p/>*
>
> * *
>
> *</div><!-- end page -->*
>
> * *
>
> *</body>*
>
> *</html>*
>
> * *
>
> * *
>
> *JSP decorator output:*
>
> * *
>
> **
>
> * *
>
> *FTL decorator output:*
>
> * *
>
> **
>
>
>
> Derrick Koes
>
> Principal Software Engineer
>
> SkillSoft <http://www.skillsoft.com/>
>
> 300 Innovative Way, Suite 201
>
> Nashua, NH 03062
>
> Tel: 603-821-3264
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
> For additional commands, e-mail: user-h...@struts.apache.org
>

Reply via email to