You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by jonathan doklovic <li...@sysbliss.com> on 2010/03/15 17:05:08 UTC

Struts2 + Sitemesh + Freemarker doesn't work

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


Re: Struts2 + Sitemesh + Freemarker doesn't work

Posted by jonathan doklovic <li...@sysbliss.com>.
Thanks,

I actually decided to just build it from source....  should have just 
done that in the first place.
That got everything mostly working, however, I'm also using the 
struts-osgi plugin and found a bug where the FreemarkerManager (in osgi 
it's BundleFreemarkerManager) wasn't looking for result templates in the 
bundles and so it was failing.

I logged an issue and attached a patch that fixes it.

https://issues.apache.org/jira/browse/WW-3409

Thanks again,

- Jonathan

Wes Wannemacher wrote:
> On Thu, Mar 18, 2010 at 12:02 PM, jonathan doklovic
> <li...@sysbliss.com> wrote:
>   
>> I almost have this working, however, it seems that
>> struts-core-2.2.0-SNAPSHOT depends on xwork-2.2.0-SNAPSHOT which doesn't
>> seem to be available anywhere.
>>     
>
>
> It's here -
>
> http://hudson.zones.apache.org/hudson/view/Struts/job/struts2/193/com.opensymphony$xwork-core/
>
> ---------------------------------------------------------------------
> 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


Re: Struts2 + Sitemesh + Freemarker doesn't work

Posted by Wes Wannemacher <we...@wantii.com>.
On Thu, Mar 18, 2010 at 12:02 PM, jonathan doklovic
<li...@sysbliss.com> wrote:
> I almost have this working, however, it seems that
> struts-core-2.2.0-SNAPSHOT depends on xwork-2.2.0-SNAPSHOT which doesn't
> seem to be available anywhere.


It's here -

http://hudson.zones.apache.org/hudson/view/Struts/job/struts2/193/com.opensymphony$xwork-core/

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


Re: Struts2 + Sitemesh + Freemarker doesn't work

Posted by jonathan doklovic <li...@sysbliss.com>.
I almost have this working, however, it seems that 
struts-core-2.2.0-SNAPSHOT depends on xwork-2.2.0-SNAPSHOT which doesn't 
seem to be available anywhere.

Also, the struts-convention-2.2.0-SNAPSHOT tries to call a method in 
xwork that doesn't exist:
com.opensymphony.xwork2.util.finder.ClassFinder.<init>(Lcom/opensymphony/xwork2/util/finder/ClassLoaderInterface;Ljava/util/Collection;ZLjava/util/Set;Lcom/opensymphony/xwork2/util/finder/Test;)V

I assume that's going to be in xwork 2.2?

- Jonathan


Lukasz Lenart wrote:
> 2010/3/16 jonathan doklovic <li...@sysbliss.com>:
>   
>> I was able to resolve the issue simply by using the snapshot jar listed on
>> this blog post: http://www.stonescape.net/roller/xtian/date/20091021
>>
>> My web.xml was correct, just needed the updated sitemesh plugin.
>>     
>
> Here you have the whole build
> http://hudson.zones.apache.org/hudson/view/Struts/job/struts2/193/
>
> I added proper web.xml config for full integration with SiteMesh 2 +
> Freemarker 2.4.2 + Velocity 1.3 , including Struts 2 Tags, ValueStack,
> and FreemarkerManager statics.
> http://struts.apache.org/2.x/docs/sitemesh-plugin.html
>
>
> Regards
>   


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


Re: Struts2 + Sitemesh + Freemarker doesn't work

Posted by Lukasz Lenart <lu...@googlemail.com>.
2010/3/17 jonathan doklovic <li...@sysbliss.com>:
> Are the artifacts in a snapshot repo somewhere, or do i have to manually
> install them into local?

Not yet, I'm working on that ;-)


Regards
-- 
Łukasz
http://www.lenart.org.pl/
Kapituła Javarsovia 2010
http://javarsovia.pl

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


Re: Struts2 + Sitemesh + Freemarker doesn't work

Posted by jonathan doklovic <li...@sysbliss.com>.
Thanks,

Are the artifacts in a snapshot repo somewhere, or do i have to manually 
install them into local?

- J

Lukasz Lenart wrote:
> 2010/3/16 jonathan doklovic <li...@sysbliss.com>:
>   
>> I was able to resolve the issue simply by using the snapshot jar listed on
>> this blog post: http://www.stonescape.net/roller/xtian/date/20091021
>>
>> My web.xml was correct, just needed the updated sitemesh plugin.
>>     
>
> Here you have the whole build
> http://hudson.zones.apache.org/hudson/view/Struts/job/struts2/193/
>
> I added proper web.xml config for full integration with SiteMesh 2 +
> Freemarker 2.4.2 + Velocity 1.3 , including Struts 2 Tags, ValueStack,
> and FreemarkerManager statics.
> http://struts.apache.org/2.x/docs/sitemesh-plugin.html
>
>
> Regards
>   


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


Re: Struts2 + Sitemesh + Freemarker doesn't work

Posted by Lukasz Lenart <lu...@googlemail.com>.
2010/3/16 jonathan doklovic <li...@sysbliss.com>:
> I was able to resolve the issue simply by using the snapshot jar listed on
> this blog post: http://www.stonescape.net/roller/xtian/date/20091021
>
> My web.xml was correct, just needed the updated sitemesh plugin.

Here you have the whole build
http://hudson.zones.apache.org/hudson/view/Struts/job/struts2/193/

I added proper web.xml config for full integration with SiteMesh 2 +
Freemarker 2.4.2 + Velocity 1.3 , including Struts 2 Tags, ValueStack,
and FreemarkerManager statics.
http://struts.apache.org/2.x/docs/sitemesh-plugin.html


Regards
-- 
Łukasz
http://www.lenart.org.pl/
Kapituła Javarsovia 2010
http://javarsovia.pl

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


Re: Struts2 + Sitemesh + Freemarker doesn't work

Posted by jonathan doklovic <li...@sysbliss.com>.
I was able to resolve the issue simply by using the snapshot jar listed 
on this blog post: http://www.stonescape.net/roller/xtian/date/20091021

My web.xml was correct, just needed the updated sitemesh plugin.


jonathan doklovic wrote:
> 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
>> <li...@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
>>>> <li...@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


Re: Struts2 + Sitemesh + Freemarker doesn't work

Posted by jonathan doklovic <li...@sysbliss.com>.
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
> <li...@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
>>> <li...@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


Re: Struts2 + Sitemesh + Freemarker doesn't work

Posted by Wes Wannemacher <we...@wantii.com>.
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
<li...@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
>> <li...@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
>
>



-- 
Wes Wannemacher

Head Engineer, WanTii, Inc.
Need Training? Struts, Spring, Maven, Tomcat...
Ask me for a quote!

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


Re: Struts2 + Sitemesh + Freemarker doesn't work

Posted by jonathan doklovic <li...@sysbliss.com>.
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
> <li...@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


Re: Struts2 + Sitemesh + Freemarker doesn't work

Posted by Wes Wannemacher <we...@wantii.com>.
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
<li...@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
>
>



-- 
Wes Wannemacher

Head Engineer, WanTii, Inc.
Need Training? Struts, Spring, Maven, Tomcat...
Ask me for a quote!

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