You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by CS Wong <li...@gmail.com> on 2009/08/11 12:10:41 UTC

Configuring SiteMesh for specific action mappings in Struts 2?

Hi,
I'm trying to configure sitemesh to only take effect for a certain subset of
action mappings in my Struts 2 application.

Say for example, I have the following struts.xml snippet:

<package name="default" namespace="/" extends="struts-default">
  <action name="showForm">
    <result>/view/form.jsp</result>
  </action>
</package>
<package name="widgets" namespace="/widgets" extends="struts-default">
  <action name="showForm">
    <result>/view/form.jsp</result>
  </action>
</package>

I would like the output of "/showForm.action" to be decorated by SiteMesh
but for "/widgets/showForm.action" to be returned empty instead. The
critical part here is that I want the JSP file to be reused by both action
mappings.

But try as I might, I can't seem to get SiteMesh's <exclude/> tag to
recognize a mapping. I have to specify the file "/view/form.jsp" to be
excluded instead and that means I won't be able to reuse the JSP file.

Is there any way I can get around this?

I'm using Struts 2.0.14.

Thanks,
Wong

Re: Configuring SiteMesh for specific action mappings in Struts 2?

Posted by mu...@aol.com.
 Hopefully it solves the OP's problem.
Cheers
Chris


 


 

-----Original Message-----
From: Zoran Avtarovski <zo...@sparecreative.com>
To: Struts Users Mailing List <us...@struts.apache.org>; musomesa@aol.com
Sent: Wed, Aug 12, 2009 7:27 pm
Subject: Re: Configuring SiteMesh for specific action mappings in Struts 2?










I apologise, you’re right. But by changing it to :

<pattern>/widgets/home.action</pattern>

It will work exactly the same way and only exclude the home action when
invoked via the widgets namespace.

Z.

>  I think your pattern is on the namespace rather than the action?
> C. 
> 
> 
>  
> 
> 
>  
> 
> -----Original Message-----
> From: Zoran Avtarovski <zo...@sparecreative.com>
> To: Struts Users Mailing List <us...@struts.apache.org>; CS Wong
> <li...@gmail.com>
> Sent: Tue, Aug 11, 2009 9:49 pm
> Subject: Re: Configuring SiteMesh for specific action mappings in Struts 2?
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> I¹m certain that¹s not correct. We use the decorators.xml file extensively
> and we¹re able to have pretty fine control over the sitemesh decorators. I
> know in our installation the decorator is based on the action url rather
> than the resulting jsp file.
> 
> For example you could include a excludes pattern which ignores all widget
> requests by placing
> <pattern>/widgets/*</pattern> in your excludes section.
> 
> Z.
>> > 
>> > 
>> > Tried this route but it seems to me that they only work if the patterns

>> > specified point to physical files only. For example, it'd work if it points
>> > to "index.html" or "/view/hello.jsp".
>> > However, I was assuming that it would work for the output from the filter
>> > dispatcher as well. What I wanted to achieve was to have SiteMesh invoked
>> > for the output from "/hello.action" but to be excluded for
>> > "/widgets/hello.action".
>> > 
>> > Big picture-wise, what I wanted was to have one default Struts 2 package,
>> > all configured to serve full pages decorated by SiteMesh. Then I'll create
>> > another package "widgets", where there's no decorator invoked and it only
>> > serves the raw content of the JSPs returned. On my pages, if20AJAX is
>> > available, I'd dynamically change the links to load from the "widgets"
>> > package instead so I can just call the widget and render it dynamically
>> into
>> > the page using JS. I'd be able to reuse both the action classes and the JSP
>> > throughout both packages then.
>> > 
>> > BTW, I know that SiteMesh is not a native Struts 2 application so if enough
>> > people think I'm off-topic here please do let me know. I just thought that
>> > since SiteMesh is a supported plugin, it may be applicable here.
>> > 
>> > Thanks,
>> > Wong
>> > 
>> > 
>> > On Tue, Aug 11, 2009 at 8:42 PM, Eduard Neuwirt <
>> > eduard.neuwirt@googlemail.com> wrote:
>> > 
>>>> >> > Hi Wong,
>>>> >> >
>>>> >> > perhaps would the following entries from decorators.xml help you :
>>>> >>=2
0>
>>>> >> > <decorators defaultdir="/jsp/decorators">
>>>> >> >  <excludes>
>>>> >> >   <pattern>/styles/*</pattern>
>>>> >> >   <pattern>/scripts/*</pattern>
>>>> >> >   <pattern>/images/*</pattern>
>>>> >> >   <pattern>/index.html</pattern>
>>>> >> >  </excludes>
>>>> >> > ...
>>>> >> > </decorators>
>>>> >> >
>>>> >> > Regards
>>>> >> > Eduard Neuwirt
>>>> >> >
>>>> >> > CS Wong schrieb:
>>>> >> >
>>>> >> >  Hi,
>>>>>> >>> >> I'm trying to configure sitemesh to only take effect for a certain
subset
>>>>>> >>> >> of
>>>>>> >>> >> action mappings in my Struts 2 application.
>>>>>> >>> >>
>>>>>> >>> >> Say for example, I have the following struts.xml snippet:
>>>>>> >>> >>
>>>>>> >>> >> <package name="default" namespace="/" extends="struts-default">
>>>>>> >>> >>  <action name="showForm">
>>>>>> >>> >>    <result>/view/form.jsp</result>
>>>>>> >>> >>  </action>
>>>>>> >>> >> </package>
>>>>>> >>> >> <package name="widgets" nam
> espace="/widgets" extends="struts-default">
>>>>>> >>> >>  <action name="showForm">
>>>>>> >>> >>    <result>/view/form.jsp</result>
>>>>>> >>> >>  </action>
>>>>>> >>> >> </package>
>>>>>> >>> >>
>>>>>> >>> >> I would like the output of "/showForm.action" to be decorated by
>>>>>> SiteMesh
>>>>>> >>> >> but for "/widgets/showForm.action" to be returned empty instead.
The
>>>>>> >>> >> critical part here is that I want the JSP file to be reused by
both
>>>> >>> action
>>>>>> >>> >> mappings.
>>>>>> >>> >>
>>>>>> >>> >> But try as I might, I can't seem to get SiteMe
sh's <exclude/> tag
to
>>>>>> >>> >> recognize a mapping. I have to specify the file "/view/form.jsp"
to be
>>>>>> >>> >> excluded instead and that means I won't be able to reuse the JSP
file.
>>>>>> >>> >>
>>>>>> >>> >> Is there any way I can get around this?
>>>>>> >>> >>
>>>>>> >>> >> I'm using Struts 2.0.14.
>>>>>> >>> >>
>>>>>> >>> >> Thanks,
>>>>>> >>> >> Wong
>>>>>> >>> >>
>>>>>> >>> >>
>>>>>> >>> >>
>>>> >> >
>>>> >> >
>>>> >> > ---------------------------------------------------------------------
>>>> >> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>> >> > For additional commands, e-mail: user-help@struts.apache.org
>>>> >> >
>>>> >> >
> 
> 
> 
>  
> 



 


Re: Configuring SiteMesh for specific action mappings in Struts 2?

Posted by Zoran Avtarovski <zo...@sparecreative.com>.
I apologise, you’re right. But by changing it to :

<pattern>/widgets/home.action</pattern>

It will work exactly the same way and only exclude the home action when
invoked via the widgets namespace.

Z.

>  I think your pattern is on the namespace rather than the action?
> C. 
> 
> 
>  
> 
> 
>  
> 
> -----Original Message-----
> From: Zoran Avtarovski <zo...@sparecreative.com>
> To: Struts Users Mailing List <us...@struts.apache.org>; CS Wong
> <li...@gmail.com>
> Sent: Tue, Aug 11, 2009 9:49 pm
> Subject: Re: Configuring SiteMesh for specific action mappings in Struts 2?
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> I¹m certain that¹s not correct. We use the decorators.xml file extensively
> and we¹re able to have pretty fine control over the sitemesh decorators. I
> know in our installation the decorator is based on the action url rather
> than the resulting jsp file.
> 
> For example you could include a excludes pattern which ignores all widget
> requests by placing
> <pattern>/widgets/*</pattern> in your excludes section.
> 
> Z.
>> > 
>> > 
>> > Tried this route but it seems to me that they only work if the patterns
>> > specified point to physical files only. For example, it'd work if it points
>> > to "index.html" or "/view/hello.jsp".
>> > However, I was assuming that it would work for the output from the filter
>> > dispatcher as well. What I wanted to achieve was to have SiteMesh invoked
>> > for the output from "/hello.action" but to be excluded for
>> > "/widgets/hello.action".
>> > 
>> > Big picture-wise, what I wanted was to have one default Struts 2 package,
>> > all configured to serve full pages decorated by SiteMesh. Then I'll create
>> > another package "widgets", where there's no decorator invoked and it only
>> > serves the raw content of the JSPs returned. On my pages, if20AJAX is
>> > available, I'd dynamically change the links to load from the "widgets"
>> > package instead so I can just call the widget and render it dynamically
>> into
>> > the page using JS. I'd be able to reuse both the action classes and the JSP
>> > throughout both packages then.
>> > 
>> > BTW, I know that SiteMesh is not a native Struts 2 application so if enough
>> > people think I'm off-topic here please do let me know. I just thought that
>> > since SiteMesh is a supported plugin, it may be applicable here.
>> > 
>> > Thanks,
>> > Wong
>> > 
>> > 
>> > On Tue, Aug 11, 2009 at 8:42 PM, Eduard Neuwirt <
>> > eduard.neuwirt@googlemail.com> wrote:
>> > 
>>>> >> > Hi Wong,
>>>> >> >
>>>> >> > perhaps would the following entries from decorators.xml help you :
>>>> >> >
>>>> >> > <decorators defaultdir="/jsp/decorators">
>>>> >> >  <excludes>
>>>> >> >   <pattern>/styles/*</pattern>
>>>> >> >   <pattern>/scripts/*</pattern>
>>>> >> >   <pattern>/images/*</pattern>
>>>> >> >   <pattern>/index.html</pattern>
>>>> >> >  </excludes>
>>>> >> > ...
>>>> >> > </decorators>
>>>> >> >
>>>> >> > Regards
>>>> >> > Eduard Neuwirt
>>>> >> >
>>>> >> > CS Wong schrieb:
>>>> >> >
>>>> >> >  Hi,
>>>>>> >>> >> I'm trying to configure sitemesh to only take effect for a certain
subset
>>>>>> >>> >> of
>>>>>> >>> >> action mappings in my Struts 2 application.
>>>>>> >>> >>
>>>>>> >>> >> Say for example, I have the following struts.xml snippet:
>>>>>> >>> >>
>>>>>> >>> >> <package name="default" namespace="/" extends="struts-default">
>>>>>> >>> >>  <action name="showForm">
>>>>>> >>> >>    <result>/view/form.jsp</result>
>>>>>> >>> >>  </action>
>>>>>> >>> >> </package>
>>>>>> >>> >> <package name="widgets" nam
> espace="/widgets" extends="struts-default">
>>>>>> >>> >>  <action name="showForm">
>>>>>> >>> >>    <result>/view/form.jsp</result>
>>>>>> >>> >>  </action>
>>>>>> >>> >> </package>
>>>>>> >>> >>
>>>>>> >>> >> I would like the output of "/showForm.action" to be decorated by
>>>>>> SiteMesh
>>>>>> >>> >> but for "/widgets/showForm.action" to be returned empty instead.
The
>>>>>> >>> >> critical part here is that I want the JSP file to be reused by
both
>>>> >>> action
>>>>>> >>> >> mappings.
>>>>>> >>> >>
>>>>>> >>> >> But try as I might, I can't seem to get SiteMesh's <exclude/> tag
to
>>>>>> >>> >> recognize a mapping. I have to specify the file "/view/form.jsp"
to be
>>>>>> >>> >> excluded instead and that means I won't be able to reuse the JSP
file.
>>>>>> >>> >>
>>>>>> >>> >> Is there any way I can get around this?
>>>>>> >>> >>
>>>>>> >>> >> I'm using Struts 2.0.14.
>>>>>> >>> >>
>>>>>> >>> >> Thanks,
>>>>>> >>> >> Wong
>>>>>> >>> >>
>>>>>> >>> >>
>>>>>> >>> >>
>>>> >> >
>>>> >> >
>>>> >> > ---------------------------------------------------------------------
>>>> >> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>>> >> > For additional commands, e-mail: user-help@struts.apache.org
>>>> >> >
>>>> >> >
> 
> 
> 
>  
> 


Re: Configuring SiteMesh for specific action mappings in Struts 2?

Posted by mu...@aol.com.
 I think your pattern is on the namespace rather than the action?
C. 


 


 

-----Original Message-----
From: Zoran Avtarovski <zo...@sparecreative.com>
To: Struts Users Mailing List <us...@struts.apache.org>; CS Wong <li...@gmail.com>
Sent: Tue, Aug 11, 2009 9:49 pm
Subject: Re: Configuring SiteMesh for specific action mappings in Struts 2?










I¹m certain that¹s not correct. We use the decorators.xml file extensively
and we¹re able to have pretty fine control over the sitemesh decorators. I
know in our installation the decorator is based on the action url rather
than the resulting jsp file.

For example you could include a excludes pattern which ignores all widget
requests by placing
<pattern>/widgets/*</pattern> in your excludes section.

Z.
> 
> 
> Tried this route but it seems to me that they only work if the patterns
> specified point to physical files only. For example, it'd work if it points
> to "index.html" or "/view/hello.jsp".
> However, I was assuming that it would work for the output from the filter
> dispatcher as well. What I wanted to achieve was to have SiteMesh invoked
> for the output from "/hello.action" but to be excluded for
> "/widgets/hello.action".
> 
> Big picture-wise, what I wanted was to have one default Struts 2 package,
> all configured to serve full pages decorated by SiteMesh. Then I'll create
> another package "widgets", where there's no decorator invoked and it only
> serves the raw content of the JSPs returned. On my pages, if20AJAX is
> available, I'd dynamically change the links to load from the "widgets"
> package instead so I can just call the widget and render it dynamically into
> the page using JS. I'd be able to reuse both the action classes and the JSP
> throughout both packages then.
> 
> BTW, I know that SiteMesh is not a native Struts 2 application so if enough
> people think I'm off-topic here please do let me know. I just thought that
> since SiteMesh is a supported plugin, it may be applicable here.
> 
> Thanks,
> Wong
> 
> 
> On Tue, Aug 11, 2009 at 8:42 PM, Eduard Neuwirt <
> eduard.neuwirt@googlemail.com> wrote:
> 
>> > Hi Wong,
>> >
>> > perhaps would the following entries from decorators.xml help you :
>> >
>> > <decorators defaultdir="/jsp/decorators">
>> >  <excludes>
>> >   <pattern>/styles/*</pattern>
>> >   <pattern>/scripts/*</pattern>
>> >   <pattern>/images/*</pattern>
>> >   <pattern>/index.html</pattern>
>> >  </excludes>
>> > ...
>> > </decorators>
>> >
>> > Regards
>> > Eduard Neuwirt
>> >
>> > CS Wong schrieb:
>> >
>> >  Hi,
>>> >> I'm trying to configure sitemesh to only take effect for a certain subset
>>> >> of
>>> >> action mappings in my Struts 2 application.
>>> >>
>>> >> Say for example, I have the following struts.xml snippet:
>>> >>
>>> >> <package name="default" namespace="/" extends="struts-default">
>>> >>  <action name="showForm">
>>> >>    <result>/view/form.jsp</result>
>>> >>  </action>
>>> >> </package>
>>> >> <package name="widgets" nam
espace="/widgets" extends="struts-default">
>>> >>  <action name="showForm">
>>> >>    <result>/view/form.jsp</result>
>>> >>  </action>
>>> >> </package>
>>> >>
>>> >> I would like the output of "/showForm.action" to be decorated by SiteMesh
>>> >> but for "/widgets/showForm.action" to be returned empty instead. The
>>> >> critical part here is that I want the JSP file to be reused by both
>>> action
>>> >> mappings.
>>> >>
>>> >> But try as I might, I can't seem to get SiteMesh's <exclude/> tag to
>>> >> recognize a mapping. I have to specify the file "/view/form.jsp" to be
>>> >> excluded instead and that means I won't be able to reuse the JSP file.
>>> >>
>>> >> Is there any way I can get around this?
>>> >>
>>> >> I'm using Struts 2.0.14.
>>> >>
>>> >> Thanks,
>>> >> Wong
>>> >>
>>> >>
>>> >>
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> > For additional commands, e-mail: user-help@struts.apache.org
>> >
>> >



 


Re: Configuring SiteMesh for specific action mappings in Struts 2?

Posted by Zoran Avtarovski <zo...@sparecreative.com>.
I¹m certain that¹s not correct. We use the decorators.xml file extensively
and we¹re able to have pretty fine control over the sitemesh decorators. I
know in our installation the decorator is based on the action url rather
than the resulting jsp file.

For example you could include a excludes pattern which ignores all widget
requests by placing
<pattern>/widgets/*</pattern> in your excludes section.

Z.
> 
> 
> Tried this route but it seems to me that they only work if the patterns
> specified point to physical files only. For example, it'd work if it points
> to "index.html" or "/view/hello.jsp".
> However, I was assuming that it would work for the output from the filter
> dispatcher as well. What I wanted to achieve was to have SiteMesh invoked
> for the output from "/hello.action" but to be excluded for
> "/widgets/hello.action".
> 
> Big picture-wise, what I wanted was to have one default Struts 2 package,
> all configured to serve full pages decorated by SiteMesh. Then I'll create
> another package "widgets", where there's no decorator invoked and it only
> serves the raw content of the JSPs returned. On my pages, if AJAX is
> available, I'd dynamically change the links to load from the "widgets"
> package instead so I can just call the widget and render it dynamically into
> the page using JS. I'd be able to reuse both the action classes and the JSP
> throughout both packages then.
> 
> BTW, I know that SiteMesh is not a native Struts 2 application so if enough
> people think I'm off-topic here please do let me know. I just thought that
> since SiteMesh is a supported plugin, it may be applicable here.
> 
> Thanks,
> Wong
> 
> 
> On Tue, Aug 11, 2009 at 8:42 PM, Eduard Neuwirt <
> eduard.neuwirt@googlemail.com> wrote:
> 
>> > Hi Wong,
>> >
>> > perhaps would the following entries from decorators.xml help you :
>> >
>> > <decorators defaultdir="/jsp/decorators">
>> >  <excludes>
>> >   <pattern>/styles/*</pattern>
>> >   <pattern>/scripts/*</pattern>
>> >   <pattern>/images/*</pattern>
>> >   <pattern>/index.html</pattern>
>> >  </excludes>
>> > ...
>> > </decorators>
>> >
>> > Regards
>> > Eduard Neuwirt
>> >
>> > CS Wong schrieb:
>> >
>> >  Hi,
>>> >> I'm trying to configure sitemesh to only take effect for a certain subset
>>> >> of
>>> >> action mappings in my Struts 2 application.
>>> >>
>>> >> Say for example, I have the following struts.xml snippet:
>>> >>
>>> >> <package name="default" namespace="/" extends="struts-default">
>>> >>  <action name="showForm">
>>> >>    <result>/view/form.jsp</result>
>>> >>  </action>
>>> >> </package>
>>> >> <package name="widgets" namespace="/widgets" extends="struts-default">
>>> >>  <action name="showForm">
>>> >>    <result>/view/form.jsp</result>
>>> >>  </action>
>>> >> </package>
>>> >>
>>> >> I would like the output of "/showForm.action" to be decorated by SiteMesh
>>> >> but for "/widgets/showForm.action" to be returned empty instead. The
>>> >> critical part here is that I want the JSP file to be reused by both
>>> action
>>> >> mappings.
>>> >>
>>> >> But try as I might, I can't seem to get SiteMesh's <exclude/> tag to
>>> >> recognize a mapping. I have to specify the file "/view/form.jsp" to be
>>> >> excluded instead and that means I won't be able to reuse the JSP file.
>>> >>
>>> >> Is there any way I can get around this?
>>> >>
>>> >> I'm using Struts 2.0.14.
>>> >>
>>> >> Thanks,
>>> >> Wong
>>> >>
>>> >>
>>> >>
>> >
>> >
>> > ---------------------------------------------------------------------
>> > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> > For additional commands, e-mail: user-help@struts.apache.org
>> >
>> >


Re: Configuring SiteMesh for specific action mappings in Struts 2?

Posted by CS Wong <li...@gmail.com>.
Tried this route but it seems to me that they only work if the patterns
specified point to physical files only. For example, it'd work if it points
to "index.html" or "/view/hello.jsp".
However, I was assuming that it would work for the output from the filter
dispatcher as well. What I wanted to achieve was to have SiteMesh invoked
for the output from "/hello.action" but to be excluded for
"/widgets/hello.action".

Big picture-wise, what I wanted was to have one default Struts 2 package,
all configured to serve full pages decorated by SiteMesh. Then I'll create
another package "widgets", where there's no decorator invoked and it only
serves the raw content of the JSPs returned. On my pages, if AJAX is
available, I'd dynamically change the links to load from the "widgets"
package instead so I can just call the widget and render it dynamically into
the page using JS. I'd be able to reuse both the action classes and the JSP
throughout both packages then.

BTW, I know that SiteMesh is not a native Struts 2 application so if enough
people think I'm off-topic here please do let me know. I just thought that
since SiteMesh is a supported plugin, it may be applicable here.

Thanks,
Wong


On Tue, Aug 11, 2009 at 8:42 PM, Eduard Neuwirt <
eduard.neuwirt@googlemail.com> wrote:

> Hi Wong,
>
> perhaps would the following entries from decorators.xml help you :
>
> <decorators defaultdir="/jsp/decorators">
>  <excludes>
>   <pattern>/styles/*</pattern>
>   <pattern>/scripts/*</pattern>
>   <pattern>/images/*</pattern>
>   <pattern>/index.html</pattern>
>  </excludes>
> ...
> </decorators>
>
> Regards
> Eduard Neuwirt
>
> CS Wong schrieb:
>
>  Hi,
>> I'm trying to configure sitemesh to only take effect for a certain subset
>> of
>> action mappings in my Struts 2 application.
>>
>> Say for example, I have the following struts.xml snippet:
>>
>> <package name="default" namespace="/" extends="struts-default">
>>  <action name="showForm">
>>    <result>/view/form.jsp</result>
>>  </action>
>> </package>
>> <package name="widgets" namespace="/widgets" extends="struts-default">
>>  <action name="showForm">
>>    <result>/view/form.jsp</result>
>>  </action>
>> </package>
>>
>> I would like the output of "/showForm.action" to be decorated by SiteMesh
>> but for "/widgets/showForm.action" to be returned empty instead. The
>> critical part here is that I want the JSP file to be reused by both action
>> mappings.
>>
>> But try as I might, I can't seem to get SiteMesh's <exclude/> tag to
>> recognize a mapping. I have to specify the file "/view/form.jsp" to be
>> excluded instead and that means I won't be able to reuse the JSP file.
>>
>> Is there any way I can get around this?
>>
>> I'm using Struts 2.0.14.
>>
>> Thanks,
>> Wong
>>
>>
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>

Re: Configuring SiteMesh for specific action mappings in Struts 2?

Posted by Eduard Neuwirt <ed...@googlemail.com>.
Hi Wong,

perhaps would the following entries from decorators.xml help you :

<decorators defaultdir="/jsp/decorators">
  <excludes>
    <pattern>/styles/*</pattern>
    <pattern>/scripts/*</pattern>
    <pattern>/images/*</pattern>
    <pattern>/index.html</pattern>
  </excludes>
...
</decorators>

Regards
Eduard Neuwirt

CS Wong schrieb:
> Hi,
> I'm trying to configure sitemesh to only take effect for a certain subset of
> action mappings in my Struts 2 application.
>
> Say for example, I have the following struts.xml snippet:
>
> <package name="default" namespace="/" extends="struts-default">
>   <action name="showForm">
>     <result>/view/form.jsp</result>
>   </action>
> </package>
> <package name="widgets" namespace="/widgets" extends="struts-default">
>   <action name="showForm">
>     <result>/view/form.jsp</result>
>   </action>
> </package>
>
> I would like the output of "/showForm.action" to be decorated by SiteMesh
> but for "/widgets/showForm.action" to be returned empty instead. The
> critical part here is that I want the JSP file to be reused by both action
> mappings.
>
> But try as I might, I can't seem to get SiteMesh's <exclude/> tag to
> recognize a mapping. I have to specify the file "/view/form.jsp" to be
> excluded instead and that means I won't be able to reuse the JSP file.
>
> Is there any way I can get around this?
>
> I'm using Struts 2.0.14.
>
> Thanks,
> Wong
>
>   


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


Re: Configuring SiteMesh for specific action mappings in Struts 2?

Posted by mu...@aol.com.
 Are you able to put a parameter in your action URL -- something like .....myAction.action@&printable=true


 because in that case you can configure different (or no) decoration based on the parameter
chris


 

-----Original Message-----
From: CS Wong <li...@gmail.com>
To: Struts Users Mailing List <us...@struts.apache.org>
Sent: Tue, Aug 11, 2009 1:03 pm
Subject: Re: Configuring SiteMesh for specific action mappings in Struts 2?










If I understand you correctly, you're saying that I should have double
copies of each JSP, say "/decorated/view.jsp" and "/undecorated/view.jsp".
And I should configure the exclusion pattern like
"<exclude>/undecorated/*</exclude>".
If possible, I'd really like to avoid that. Java classes themselves already
have plenty of boilerplate code without adding JSPs to the mix :)


On Tue, Aug 11, 2009 at 10:55 PM, <mu...@aol.com> wrote:

>
>  SiteMesh is just a decorator and not Struts 2 centric so you won't find
> what you want in its native configuration.? As far as it is concerned the
> view could have been generated by a CGI script of anything. I think the path
> of least effort it to have two essentially blank JSps that include the
> actual material you want to re-use?
> Chris
>
>
>
>
>
>
>
>
> -----Original Message-----
> From: CS Wong <li...@gmail.com>
> To: user@struts.apache.org
> Sent: Tue, Aug 11, 2009 6:10 am
> Subject: Configuring SiteMesh for specific action mappings in Struts 2?
>
>
>
>
>
>
>
>
>
>
> Hi,
> I'm trying to configure sitemesh to only take effect for a certain subset
> of
> action mappings in my Struts 2 application.
>
> Say for example, I have the following struts.xml snippet:
>
> <package name="default" namespace="/" extends="struts-default">
>  <action name="showForm">
>    <result>/view/form.jsp</result>
>  </action>
> </package>
> <package name="widgets" namespace="/widgets" extends="struts-default">
>  <action name="showForm">
>    <result>/view/form.jsp</result>
>  </action>
> </package>
>
> I would like the output of "/showForm.action" to be decorated by SiteMesh
> but for "/widgets/showForm.action" to be returned empty instead. The
> critical part here is that I want the JSP file to be reused by both action
> mappings.
>
> But try as I might, I can't seem to get SiteMesh's <exclude/> tag to
> recognize a mapping. I have to specify the file "/view/form.jsp" to be
> excluded instead and that means I won't be able to reuse the JSP file.
>
> Is there any way I can get around this?
>
> I'm using Struts 2.0.14.
>
> Thanks,
> Wong
>
>
>
>
>
>



 


Re: Configuring SiteMesh for specific action mappings in Struts 2?

Posted by mu...@aol.com.
 


 You did understand me correctly and I see your dilema -- problem is the tags like <exclude> are
not aware of what action the view came from :(



 

-----Original Message-----
From: CS Wong <li...@gmail.com>
To: Struts Users Mailing List <us...@struts.apache.org>
Sent: Tue, Aug 11, 2009 1:03 pm
Subject: Re: Configuring SiteMesh for specific action mappings in Struts 2?










If I understand you correctly, you're saying that I should have double
copies of each JSP, say "/decorated/view.jsp" and "/undecorated/view.jsp".
And I should configure the exclusion pattern like
"<exclude>/undecorated/*</exclude>".
If possible, I'd really like to avoid that. Java classes themselves already
have plenty of boilerplate code without adding JSPs to the mix :)


On Tue, Aug 11, 2009 at 10:55 PM, <mu...@aol.com> wrote:

>
>  SiteMesh is just a decorator and not Struts 2 centric so you won't find
> what you want in its native configuration.? As far as it is concerned the
> view could have been generated by a CGI script of anything. I think the path
> of least effort it to have two essentially blank JSps that include the
> actual material you want to re-use?
> Chris
>
>
>
>
>
>
>
>
> -----Original Message-----
> From: CS Wong <li...@gmail.com>
> To: user@struts.apache.org
> Sent: Tue, Aug 11, 2009 6:10 am
> Subject: Configuring SiteMesh for specific action mappings in Struts 2?
>
>
>
>
>
>
>
>
>
>
> Hi,
> I'm trying to configure sitemesh to only take effect for a certain subset
> of
> action mappings in my Struts 2 application.
>
> Say for example, I have the following struts.xml snippet:
>
> <package name="default" namespace="/" extends="struts-default">
>  <action name="showForm">
>    <result>/view/form.jsp</result>
>  </action>
> </package>
> <package name="widgets" namespace="/widgets" extends="struts-default">
>  <action name="showForm">
>    <result>/view/form.jsp</result>
>  </action>
> </package>
>
> I would like the output of "/showForm.action" to be decorated by SiteMesh
> but for "/widgets/showForm.action" to be returned empty instead. The
> critical part here is that I want the JSP file to be reused by both action
> mappings.
>
> But try as I might, I can't seem to get SiteMesh's <exclude/> tag to
> recognize a mapping. I have to specify the file "/view/form.jsp" to be
> excluded instead and that means I won't be able to reuse the JSP file.
>
> Is there any way I can get around this?
>
> I'm using Struts 2.0.14.
>
> Thanks,
> Wong
>
>
>
>
>
>



 


Re: Configuring SiteMesh for specific action mappings in Struts 2?

Posted by CS Wong <li...@gmail.com>.
If I understand you correctly, you're saying that I should have double
copies of each JSP, say "/decorated/view.jsp" and "/undecorated/view.jsp".
And I should configure the exclusion pattern like
"<exclude>/undecorated/*</exclude>".
If possible, I'd really like to avoid that. Java classes themselves already
have plenty of boilerplate code without adding JSPs to the mix :)


On Tue, Aug 11, 2009 at 10:55 PM, <mu...@aol.com> wrote:

>
>  SiteMesh is just a decorator and not Struts 2 centric so you won't find
> what you want in its native configuration.? As far as it is concerned the
> view could have been generated by a CGI script of anything. I think the path
> of least effort it to have two essentially blank JSps that include the
> actual material you want to re-use?
> Chris
>
>
>
>
>
>
>
>
> -----Original Message-----
> From: CS Wong <li...@gmail.com>
> To: user@struts.apache.org
> Sent: Tue, Aug 11, 2009 6:10 am
> Subject: Configuring SiteMesh for specific action mappings in Struts 2?
>
>
>
>
>
>
>
>
>
>
> Hi,
> I'm trying to configure sitemesh to only take effect for a certain subset
> of
> action mappings in my Struts 2 application.
>
> Say for example, I have the following struts.xml snippet:
>
> <package name="default" namespace="/" extends="struts-default">
>  <action name="showForm">
>    <result>/view/form.jsp</result>
>  </action>
> </package>
> <package name="widgets" namespace="/widgets" extends="struts-default">
>  <action name="showForm">
>    <result>/view/form.jsp</result>
>  </action>
> </package>
>
> I would like the output of "/showForm.action" to be decorated by SiteMesh
> but for "/widgets/showForm.action" to be returned empty instead. The
> critical part here is that I want the JSP file to be reused by both action
> mappings.
>
> But try as I might, I can't seem to get SiteMesh's <exclude/> tag to
> recognize a mapping. I have to specify the file "/view/form.jsp" to be
> excluded instead and that means I won't be able to reuse the JSP file.
>
> Is there any way I can get around this?
>
> I'm using Struts 2.0.14.
>
> Thanks,
> Wong
>
>
>
>
>
>

Re: Configuring SiteMesh for specific action mappings in Struts 2?

Posted by mu...@aol.com.
 SiteMesh is just a decorator and not Struts 2 centric so you won't find what you want in its native configuration.? As far as it is concerned the view could have been generated by a CGI script of anything. I think the path of least effort it to have two essentially blank JSps that include the actual material you want to re-use? 
Chris



 


 

-----Original Message-----
From: CS Wong <li...@gmail.com>
To: user@struts.apache.org
Sent: Tue, Aug 11, 2009 6:10 am
Subject: Configuring SiteMesh for specific action mappings in Struts 2?










Hi,
I'm trying to configure sitemesh to only take effect for a certain subset of
action mappings in my Struts 2 application.

Say for example, I have the following struts.xml snippet:

<package name="default" namespace="/" extends="struts-default">
  <action name="showForm">
    <result>/view/form.jsp</result>
  </action>
</package>
<package name="widgets" namespace="/widgets" extends="struts-default">
  <action name="showForm">
    <result>/view/form.jsp</result>
  </action>
</package>

I would like the output of "/showForm.action" to be decorated by SiteMesh
but for "/widgets/showForm.action" to be returned empty instead. The
critical part here is that I want the JSP file to be reused by both action
mappings.

But try as I might, I can't seem to get SiteMesh's <exclude/> tag to
recognize a mapping. I have to specify the file "/view/form.jsp" to be
excluded instead and that means I won't be able to reuse the JSP file.

Is there any way I can get around this?

I'm using Struts 2.0.14.

Thanks,
Wong