struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jonathan doklovic <list-rea...@sysbliss.com>
Subject Re: Struts2 + Sitemesh + Freemarker doesn't work
Date Mon, 15 Mar 2010 18:38:53 GMT
It seems that the patch mentioned in WW-3296 would fix my problem, 
however it lists:

 <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>

But that class doesn't exist in the 2.1.8.1 release.  I think it's only 
applied to struts 2.2.0 but I can't find a build of 2.2.0 anywhere.

I've also tried every combination of filters/servlets, including the 
com.opensymphony.sitemesh.webapp.SiteMeshFilter and nothing works.

I could attached my webapp, but if it's already fixed in 2.2.0, I'm 
guessing I'll just have to wait for that?

- Jonathan


Wes Wannemacher wrote:
> I am not decorating JSP with freemarker decorators, I am decorating
> JSP with JSP, but I use the following filter -
>
>     <filter>
>         <filter-name>sitemesh</filter-name>
>         <filter-class>com.opensymphony.sitemesh.webapp.SiteMeshFilter</filter-class>
>     </filter>
>
> The filter you are using might be buggy... I don't know if it has seen
> any attention in a while. If you get a moment, whip up a simple
> example web-app that demonstrates the problem and create a JIRA on it.
> A quick look in JIRA shows that someone was working on a solution for
> sitemesh issues -
>
> http://issues.apache.org/jira/browse/WW-3296
>
> But, I haven't seen a patch yet. Anyhow, I don't know sitemesh well
> enough to say whether using SiteMeshFilter will fix your problem, but
> give it a try. If you provide a sample app, I'll try to get it fixed
> for the next release.
>
> -Wes
>
> On Mon, Mar 15, 2010 at 1:19 PM, jonathan doklovic
> <list-reader@sysbliss.com> wrote:
>   
>> All of the code is listed in the stackoverflow question.
>>
>> I'm using:
>>
>> Struts 2.1.8.1
>> Struts-Sitemesh Plugin 2.1.8.1
>> Sitemesh 2.4.2
>> Freemarker 2.3.15
>>
>> Currently, I just have a single index.action that returns index.jsp which is
>> decorated with a single main.ftl file.
>>
>> The jsp just has the simplest html structur with a string in the body.
>> The ftl decorator just adds a string and tries to spit out the body of the
>> jsp.
>>
>> my struts.xml is:
>>
>> <struts>
>>   <constant name="struts.devMode" value="true"/>
>>   <package name="basicstruts2" extends="struts-default">
>>       <action name="index">
>>           <result>/index.jsp</result>
>>       </action>
>>   </package>
>> </struts>
>>
>> my web.xml filters are:
>>
>> <filter>
>>       <filter-name>struts-prepare</filter-name>
>>
>> <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareFilter</filter-class>
>>   </filter>
>>
>>   <filter>
>>       <filter-name>sitemesh</filter-name>
>>
>> <filter-class>org.apache.struts2.sitemesh.FreeMarkerPageFilter</filter-class>
>>   </filter>
>>
>>   <filter>
>>       <filter-name>struts2</filter-name>
>>
>> <filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsExecuteFilter</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>
>>       <dispatcher>REQUEST</dispatcher>
>>       <dispatcher>FORWARD</dispatcher>
>>       <dispatcher>INCLUDE</dispatcher>
>>   </filter-mapping>
>>
>>   <filter-mapping>
>>       <filter-name>struts2</filter-name>
>>       <url-pattern>/*</url-pattern>
>>   </filter-mapping>
>>
>>
>>
>>
>> Wes Wannemacher wrote:
>>     
>>> We'll probably need a little more info. In particular, I'd like to
>>> know is which versions of struts, sitemesh and freemarker you are
>>> using. Also, how do you have the various filters configured in your
>>> struts.xml. Also, are you decorating freemarker results with
>>> freemarker decorators?
>>>
>>> -Wes
>>>
>>> On Mon, Mar 15, 2010 at 12:05 PM, jonathan doklovic
>>> <list-reader@sysbliss.com> wrote:
>>>
>>>       
>>>> I've been working for a week now trying to get Struts2 + Sitemesh +
>>>> Freemarker to work.
>>>> I've followed many tutorials and read docs but I still can't get it to
>>>> work.
>>>>
>>>> Basically the decorator runs, but none of the variables get put into
>>>> scope
>>>> and so I get literal ${body}, ${title} and ${head} printed out.
>>>>
>>>> You can find full details with my source in my stack overflow question:
>>>>
>>>> http://stackoverflow.com/questions/2420752/struts2-sitemesh-freemarker-doesnt-work
>>>>
>>>> Can anyone help???
>>>>
>>>> Thanks,
>>>>
>>>> - Jonathan
>>>>
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>> For additional commands, e-mail: user-help@struts.apache.org
>>>>
>>>>
>>>>
>>>>         
>>>
>>>
>>>       
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>>     
>
>
>
>   


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message