You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Greg Lindholm <gr...@gmail.com> on 2010/11/30 16:35:49 UTC

S2 and Sitemesh basic configuration

I'm working on my first project that will use sitemesh and have some
questions on basic configuration with Struts2.

Info:
struts 2.2.1
sitemesh 2.4.1
My decorators will be JSP files

I'm looking at the struts2-sitemesh-plugin doc
http://struts.apache.org/2.2.1/docs/sitemesh-plugin.html

Question 1) If I want to access struts2 resources (from the action or
value stack) and use struts2 tags from the decorator JSP then I need
to use the sitemesh plugin, is that correct?

Question 2) Do I need to configure the FreemarkerDecoratorServlet and
VelocityDecoratorServlet since I'm only using JSP decorators? (I think
not, but better ask.)

Question 3) Do I need to configure the JspSupportServlet?  It's listed
under the Full Integration section with no mapping and no description?
What does it do?

Question 4) In the "Example" section of the doc the sitemesh filter
appears after the two struts filters, is this correct? I was under the
impression that the sitemesh filter must be declared between the
struts-prepare and struts-execute filters.  Is this the example wrong?


Thanks

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


Re: S2 and Sitemesh basic configuration

Posted by Greg Lindholm <gr...@gmail.com>.
Thanks Maurizio.

To wrap this up; here are the changes I needed to make to web.xml to
use Sitemesh with Struts 2.2.1:

<filter>
	<filter-name>struts2-prepare</filter-name>
	<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareFilter</filter-class>
</filter>
<filter>
	<filter-name>sitemesh</filter-name>
	<filter-class>com.opensymphony.sitemesh.webapp.SiteMeshFilter</filter-class>
</filter>
<filter>
	<filter-name>struts2-execute</filter-name>
	<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsExecuteFilter</filter-class>
</filter>

<filter-mapping>
	<filter-name>struts2-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-execute</filter-name>
	<url-pattern>/*</url-pattern>
</filter-mapping>

Thanks



On Fri, Dec 3, 2010 at 12:45 PM, Maurizio Cucchiara
<ma...@gmail.com> wrote:
> You must include struts-sitemesh-plugin only if you need to use
> (Freemarker, Velocity)DecoratorServlet, otherwise you can use only
> sitemesh filter.
>
> 2010/12/3 Greg Lindholm <gr...@gmail.com>:
>> Thanks Brain.
>>
>> Can anyone else give me a definitive answer about the struts2-sitemesh-plugin?
>> Is it actually needed if you are using JSP decorators?
>>
>> I've done a few little tests and it doesn't appear to be needed.  I've
>> including struts tags in the decorator JSP file and I can access my
>> action properties.
>>
>> Thanks
>>
>> On Tue, Nov 30, 2010 at 1:26 PM, Brian Thompson <el...@gmail.com> wrote:
>>> Hmm, I just took a second look.  We do actually have
>>> struts2-sitemesh-plugin.jar in our classpath.  OTOH, it doesn't seem to be
>>> used anywhere.  From the documentation available (
>>> http://struts.apache.org/2.x/docs/sitemesh-plugin.html), it sounds like the
>>> plugin is only important if you're using Velocity or Freemarker.
>>>
>>> I might be missing something here, but based on my project files, it seems
>>> to make sense.  Someone more experienced with Sitemesh could probably give
>>> you a better answer than I can.
>>>
>>> -Brian
>>>
>>>
>>>
>>> On Tue, Nov 30, 2010 at 11:02 AM, Greg Lindholm <gr...@gmail.com>wrote:
>>>
>>>> Brian, you are saying I can use struts tags and access the action etc
>>>> in my JSP decorator without needing the struts2-sitemesh-plugin?
>>>> (This would be great, but then what is the plugin for?)
>>>>
>>>> Thanks Dave, Brian for the clarification on the filter vs filter-mapping
>>>> order.
>>>>
>>>>
>>>> On Tue, Nov 30, 2010 at 10:53 AM, Brian Thompson <el...@gmail.com>
>>>> wrote:
>>>> > Re: Question 1 -
>>>> >
>>>> > No, you can use other taglibs inside a decorator file.  My user.jsp
>>>> > (decorator) has the following lines:
>>>> >
>>>> > <%-- Include struts tag declaration --%>
>>>> > <%@ include file="/common/taglibs.jsp"%>
>>>> >
>>>> > <title><decorator:title/> - <s:text name="webapp.name"/></title>
>>>> >
>>>> > (it also uses <c:if> in places.  All you need to do is declare the taglib
>>>> > with e.g.
>>>> > <%@ taglib uri="/struts-tags" prefix="s" %>
>>>> > Simple!)
>>>> >
>>>> >
>>>> >
>>>> > Re: Question 4 -
>>>> >
>>>> > In my project, I have the filters mapped like this:
>>>> >
>>>> >    <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>
>>>> >
>>>> >
>>>> > Hope this helps,
>>>> >
>>>> > Brian
>>>> >
>>>> >
>>>> > On Tue, Nov 30, 2010 at 9:35 AM, Greg Lindholm <greg.lindholm@gmail.com
>>>> >wrote:
>>>> >
>>>> >> I'm working on my first project that will use sitemesh and have some
>>>> >> questions on basic configuration with Struts2.
>>>> >>
>>>> >> Info:
>>>> >> struts 2.2.1
>>>> >> sitemesh 2.4.1
>>>> >> My decorators will be JSP files
>>>> >>
>>>> >> I'm looking at the struts2-sitemesh-plugin doc
>>>> >> http://struts.apache.org/2.2.1/docs/sitemesh-plugin.html
>>>> >>
>>>> >> Question 1) If I want to access struts2 resources (from the action or
>>>> >> value stack) and use struts2 tags from the decorator JSP then I need
>>>> >> to use the sitemesh plugin, is that correct?
>>>> >>
>>>> >> Question 2) Do I need to configure the FreemarkerDecoratorServlet and
>>>> >> VelocityDecoratorServlet since I'm only using JSP decorators? (I think
>>>> >> not, but better ask.)
>>>> >>
>>>> >> Question 3) Do I need to configure the JspSupportServlet?  It's listed
>>>> >> under the Full Integration section with no mapping and no description?
>>>> >> What does it do?
>>>> >>
>>>> >> Question 4) In the "Example" section of the doc the sitemesh filter
>>>> >> appears after the two struts filters, is this correct? I was under the
>>>> >> impression that the sitemesh filter must be declared between the
>>>> >> struts-prepare and struts-execute filters.  Is this the example wrong?
>>>> >>
>>>> >>
>>>> >> Thanks
>>>> >>
>>>> >> ---------------------------------------------------------------------
>>>> >> 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
>>
>>
>
>
>
> --
> Maurizio Cucchiara
>
> ---------------------------------------------------------------------
> 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: S2 and Sitemesh basic configuration

Posted by Maurizio Cucchiara <ma...@gmail.com>.
You must include struts-sitemesh-plugin only if you need to use
(Freemarker, Velocity)DecoratorServlet, otherwise you can use only
sitemesh filter.

2010/12/3 Greg Lindholm <gr...@gmail.com>:
> Thanks Brain.
>
> Can anyone else give me a definitive answer about the struts2-sitemesh-plugin?
> Is it actually needed if you are using JSP decorators?
>
> I've done a few little tests and it doesn't appear to be needed.  I've
> including struts tags in the decorator JSP file and I can access my
> action properties.
>
> Thanks
>
> On Tue, Nov 30, 2010 at 1:26 PM, Brian Thompson <el...@gmail.com> wrote:
>> Hmm, I just took a second look.  We do actually have
>> struts2-sitemesh-plugin.jar in our classpath.  OTOH, it doesn't seem to be
>> used anywhere.  From the documentation available (
>> http://struts.apache.org/2.x/docs/sitemesh-plugin.html), it sounds like the
>> plugin is only important if you're using Velocity or Freemarker.
>>
>> I might be missing something here, but based on my project files, it seems
>> to make sense.  Someone more experienced with Sitemesh could probably give
>> you a better answer than I can.
>>
>> -Brian
>>
>>
>>
>> On Tue, Nov 30, 2010 at 11:02 AM, Greg Lindholm <gr...@gmail.com>wrote:
>>
>>> Brian, you are saying I can use struts tags and access the action etc
>>> in my JSP decorator without needing the struts2-sitemesh-plugin?
>>> (This would be great, but then what is the plugin for?)
>>>
>>> Thanks Dave, Brian for the clarification on the filter vs filter-mapping
>>> order.
>>>
>>>
>>> On Tue, Nov 30, 2010 at 10:53 AM, Brian Thompson <el...@gmail.com>
>>> wrote:
>>> > Re: Question 1 -
>>> >
>>> > No, you can use other taglibs inside a decorator file.  My user.jsp
>>> > (decorator) has the following lines:
>>> >
>>> > <%-- Include struts tag declaration --%>
>>> > <%@ include file="/common/taglibs.jsp"%>
>>> >
>>> > <title><decorator:title/> - <s:text name="webapp.name"/></title>
>>> >
>>> > (it also uses <c:if> in places.  All you need to do is declare the taglib
>>> > with e.g.
>>> > <%@ taglib uri="/struts-tags" prefix="s" %>
>>> > Simple!)
>>> >
>>> >
>>> >
>>> > Re: Question 4 -
>>> >
>>> > In my project, I have the filters mapped like this:
>>> >
>>> >    <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>
>>> >
>>> >
>>> > Hope this helps,
>>> >
>>> > Brian
>>> >
>>> >
>>> > On Tue, Nov 30, 2010 at 9:35 AM, Greg Lindholm <greg.lindholm@gmail.com
>>> >wrote:
>>> >
>>> >> I'm working on my first project that will use sitemesh and have some
>>> >> questions on basic configuration with Struts2.
>>> >>
>>> >> Info:
>>> >> struts 2.2.1
>>> >> sitemesh 2.4.1
>>> >> My decorators will be JSP files
>>> >>
>>> >> I'm looking at the struts2-sitemesh-plugin doc
>>> >> http://struts.apache.org/2.2.1/docs/sitemesh-plugin.html
>>> >>
>>> >> Question 1) If I want to access struts2 resources (from the action or
>>> >> value stack) and use struts2 tags from the decorator JSP then I need
>>> >> to use the sitemesh plugin, is that correct?
>>> >>
>>> >> Question 2) Do I need to configure the FreemarkerDecoratorServlet and
>>> >> VelocityDecoratorServlet since I'm only using JSP decorators? (I think
>>> >> not, but better ask.)
>>> >>
>>> >> Question 3) Do I need to configure the JspSupportServlet?  It's listed
>>> >> under the Full Integration section with no mapping and no description?
>>> >> What does it do?
>>> >>
>>> >> Question 4) In the "Example" section of the doc the sitemesh filter
>>> >> appears after the two struts filters, is this correct? I was under the
>>> >> impression that the sitemesh filter must be declared between the
>>> >> struts-prepare and struts-execute filters.  Is this the example wrong?
>>> >>
>>> >>
>>> >> Thanks
>>> >>
>>> >> ---------------------------------------------------------------------
>>> >> 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
>
>



-- 
Maurizio Cucchiara

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


Re: S2 and Sitemesh basic configuration

Posted by Greg Lindholm <gr...@gmail.com>.
Thanks Brain.

Can anyone else give me a definitive answer about the struts2-sitemesh-plugin?
Is it actually needed if you are using JSP decorators?

I've done a few little tests and it doesn't appear to be needed.  I've
including struts tags in the decorator JSP file and I can access my
action properties.

Thanks

On Tue, Nov 30, 2010 at 1:26 PM, Brian Thompson <el...@gmail.com> wrote:
> Hmm, I just took a second look.  We do actually have
> struts2-sitemesh-plugin.jar in our classpath.  OTOH, it doesn't seem to be
> used anywhere.  From the documentation available (
> http://struts.apache.org/2.x/docs/sitemesh-plugin.html), it sounds like the
> plugin is only important if you're using Velocity or Freemarker.
>
> I might be missing something here, but based on my project files, it seems
> to make sense.  Someone more experienced with Sitemesh could probably give
> you a better answer than I can.
>
> -Brian
>
>
>
> On Tue, Nov 30, 2010 at 11:02 AM, Greg Lindholm <gr...@gmail.com>wrote:
>
>> Brian, you are saying I can use struts tags and access the action etc
>> in my JSP decorator without needing the struts2-sitemesh-plugin?
>> (This would be great, but then what is the plugin for?)
>>
>> Thanks Dave, Brian for the clarification on the filter vs filter-mapping
>> order.
>>
>>
>> On Tue, Nov 30, 2010 at 10:53 AM, Brian Thompson <el...@gmail.com>
>> wrote:
>> > Re: Question 1 -
>> >
>> > No, you can use other taglibs inside a decorator file.  My user.jsp
>> > (decorator) has the following lines:
>> >
>> > <%-- Include struts tag declaration --%>
>> > <%@ include file="/common/taglibs.jsp"%>
>> >
>> > <title><decorator:title/> - <s:text name="webapp.name"/></title>
>> >
>> > (it also uses <c:if> in places.  All you need to do is declare the taglib
>> > with e.g.
>> > <%@ taglib uri="/struts-tags" prefix="s" %>
>> > Simple!)
>> >
>> >
>> >
>> > Re: Question 4 -
>> >
>> > In my project, I have the filters mapped like this:
>> >
>> >    <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>
>> >
>> >
>> > Hope this helps,
>> >
>> > Brian
>> >
>> >
>> > On Tue, Nov 30, 2010 at 9:35 AM, Greg Lindholm <greg.lindholm@gmail.com
>> >wrote:
>> >
>> >> I'm working on my first project that will use sitemesh and have some
>> >> questions on basic configuration with Struts2.
>> >>
>> >> Info:
>> >> struts 2.2.1
>> >> sitemesh 2.4.1
>> >> My decorators will be JSP files
>> >>
>> >> I'm looking at the struts2-sitemesh-plugin doc
>> >> http://struts.apache.org/2.2.1/docs/sitemesh-plugin.html
>> >>
>> >> Question 1) If I want to access struts2 resources (from the action or
>> >> value stack) and use struts2 tags from the decorator JSP then I need
>> >> to use the sitemesh plugin, is that correct?
>> >>
>> >> Question 2) Do I need to configure the FreemarkerDecoratorServlet and
>> >> VelocityDecoratorServlet since I'm only using JSP decorators? (I think
>> >> not, but better ask.)
>> >>
>> >> Question 3) Do I need to configure the JspSupportServlet?  It's listed
>> >> under the Full Integration section with no mapping and no description?
>> >> What does it do?
>> >>
>> >> Question 4) In the "Example" section of the doc the sitemesh filter
>> >> appears after the two struts filters, is this correct? I was under the
>> >> impression that the sitemesh filter must be declared between the
>> >> struts-prepare and struts-execute filters.  Is this the example wrong?
>> >>
>> >>
>> >> Thanks
>> >>
>> >> ---------------------------------------------------------------------
>> >> 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: S2 and Sitemesh basic configuration

Posted by Brian Thompson <el...@gmail.com>.
Hmm, I just took a second look.  We do actually have
struts2-sitemesh-plugin.jar in our classpath.  OTOH, it doesn't seem to be
used anywhere.  From the documentation available (
http://struts.apache.org/2.x/docs/sitemesh-plugin.html), it sounds like the
plugin is only important if you're using Velocity or Freemarker.

I might be missing something here, but based on my project files, it seems
to make sense.  Someone more experienced with Sitemesh could probably give
you a better answer than I can.

-Brian



On Tue, Nov 30, 2010 at 11:02 AM, Greg Lindholm <gr...@gmail.com>wrote:

> Brian, you are saying I can use struts tags and access the action etc
> in my JSP decorator without needing the struts2-sitemesh-plugin?
> (This would be great, but then what is the plugin for?)
>
> Thanks Dave, Brian for the clarification on the filter vs filter-mapping
> order.
>
>
> On Tue, Nov 30, 2010 at 10:53 AM, Brian Thompson <el...@gmail.com>
> wrote:
> > Re: Question 1 -
> >
> > No, you can use other taglibs inside a decorator file.  My user.jsp
> > (decorator) has the following lines:
> >
> > <%-- Include struts tag declaration --%>
> > <%@ include file="/common/taglibs.jsp"%>
> >
> > <title><decorator:title/> - <s:text name="webapp.name"/></title>
> >
> > (it also uses <c:if> in places.  All you need to do is declare the taglib
> > with e.g.
> > <%@ taglib uri="/struts-tags" prefix="s" %>
> > Simple!)
> >
> >
> >
> > Re: Question 4 -
> >
> > In my project, I have the filters mapped like this:
> >
> >    <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>
> >
> >
> > Hope this helps,
> >
> > Brian
> >
> >
> > On Tue, Nov 30, 2010 at 9:35 AM, Greg Lindholm <greg.lindholm@gmail.com
> >wrote:
> >
> >> I'm working on my first project that will use sitemesh and have some
> >> questions on basic configuration with Struts2.
> >>
> >> Info:
> >> struts 2.2.1
> >> sitemesh 2.4.1
> >> My decorators will be JSP files
> >>
> >> I'm looking at the struts2-sitemesh-plugin doc
> >> http://struts.apache.org/2.2.1/docs/sitemesh-plugin.html
> >>
> >> Question 1) If I want to access struts2 resources (from the action or
> >> value stack) and use struts2 tags from the decorator JSP then I need
> >> to use the sitemesh plugin, is that correct?
> >>
> >> Question 2) Do I need to configure the FreemarkerDecoratorServlet and
> >> VelocityDecoratorServlet since I'm only using JSP decorators? (I think
> >> not, but better ask.)
> >>
> >> Question 3) Do I need to configure the JspSupportServlet?  It's listed
> >> under the Full Integration section with no mapping and no description?
> >> What does it do?
> >>
> >> Question 4) In the "Example" section of the doc the sitemesh filter
> >> appears after the two struts filters, is this correct? I was under the
> >> impression that the sitemesh filter must be declared between the
> >> struts-prepare and struts-execute filters.  Is this the example wrong?
> >>
> >>
> >> Thanks
> >>
> >> ---------------------------------------------------------------------
> >> 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: S2 and Sitemesh basic configuration

Posted by Greg Lindholm <gr...@gmail.com>.
Brian, you are saying I can use struts tags and access the action etc
in my JSP decorator without needing the struts2-sitemesh-plugin?
(This would be great, but then what is the plugin for?)

Thanks Dave, Brian for the clarification on the filter vs filter-mapping order.


On Tue, Nov 30, 2010 at 10:53 AM, Brian Thompson <el...@gmail.com> wrote:
> Re: Question 1 -
>
> No, you can use other taglibs inside a decorator file.  My user.jsp
> (decorator) has the following lines:
>
> <%-- Include struts tag declaration --%>
> <%@ include file="/common/taglibs.jsp"%>
>
> <title><decorator:title/> - <s:text name="webapp.name"/></title>
>
> (it also uses <c:if> in places.  All you need to do is declare the taglib
> with e.g.
> <%@ taglib uri="/struts-tags" prefix="s" %>
> Simple!)
>
>
>
> Re: Question 4 -
>
> In my project, I have the filters mapped like this:
>
>    <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>
>
>
> Hope this helps,
>
> Brian
>
>
> On Tue, Nov 30, 2010 at 9:35 AM, Greg Lindholm <gr...@gmail.com>wrote:
>
>> I'm working on my first project that will use sitemesh and have some
>> questions on basic configuration with Struts2.
>>
>> Info:
>> struts 2.2.1
>> sitemesh 2.4.1
>> My decorators will be JSP files
>>
>> I'm looking at the struts2-sitemesh-plugin doc
>> http://struts.apache.org/2.2.1/docs/sitemesh-plugin.html
>>
>> Question 1) If I want to access struts2 resources (from the action or
>> value stack) and use struts2 tags from the decorator JSP then I need
>> to use the sitemesh plugin, is that correct?
>>
>> Question 2) Do I need to configure the FreemarkerDecoratorServlet and
>> VelocityDecoratorServlet since I'm only using JSP decorators? (I think
>> not, but better ask.)
>>
>> Question 3) Do I need to configure the JspSupportServlet?  It's listed
>> under the Full Integration section with no mapping and no description?
>> What does it do?
>>
>> Question 4) In the "Example" section of the doc the sitemesh filter
>> appears after the two struts filters, is this correct? I was under the
>> impression that the sitemesh filter must be declared between the
>> struts-prepare and struts-execute filters.  Is this the example wrong?
>>
>>
>> Thanks
>>
>> ---------------------------------------------------------------------
>> 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: S2 and Sitemesh basic configuration

Posted by Brian Thompson <el...@gmail.com>.
Re: Question 1 -

No, you can use other taglibs inside a decorator file.  My user.jsp
(decorator) has the following lines:

<%-- Include struts tag declaration --%>
<%@ include file="/common/taglibs.jsp"%>

<title><decorator:title/> - <s:text name="webapp.name"/></title>

(it also uses <c:if> in places.  All you need to do is declare the taglib
with e.g.
<%@ taglib uri="/struts-tags" prefix="s" %>
Simple!)



Re: Question 4 -

In my project, I have the filters mapped like this:

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


Hope this helps,

Brian


On Tue, Nov 30, 2010 at 9:35 AM, Greg Lindholm <gr...@gmail.com>wrote:

> I'm working on my first project that will use sitemesh and have some
> questions on basic configuration with Struts2.
>
> Info:
> struts 2.2.1
> sitemesh 2.4.1
> My decorators will be JSP files
>
> I'm looking at the struts2-sitemesh-plugin doc
> http://struts.apache.org/2.2.1/docs/sitemesh-plugin.html
>
> Question 1) If I want to access struts2 resources (from the action or
> value stack) and use struts2 tags from the decorator JSP then I need
> to use the sitemesh plugin, is that correct?
>
> Question 2) Do I need to configure the FreemarkerDecoratorServlet and
> VelocityDecoratorServlet since I'm only using JSP decorators? (I think
> not, but better ask.)
>
> Question 3) Do I need to configure the JspSupportServlet?  It's listed
> under the Full Integration section with no mapping and no description?
> What does it do?
>
> Question 4) In the "Example" section of the doc the sitemesh filter
> appears after the two struts filters, is this correct? I was under the
> impression that the sitemesh filter must be declared between the
> struts-prepare and struts-execute filters.  Is this the example wrong?
>
>
> Thanks
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: S2 and Sitemesh basic configuration

Posted by Dave Newton <da...@gmail.com>.
On Tue, Nov 30, 2010 at 10:35 AM, Greg Lindholm wrote:

> Question 4) In the "Example" section of the doc the sitemesh filter
> appears after the two struts filters, is this correct? I was under the
> impression that the sitemesh filter must be declared between the
> struts-prepare and struts-execute filters.  Is this the example wrong?
>

The declaration order of filters doesn't matter: it's the filter-mappings
that are ordered.

Dave