struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mark Menard <m...@mjm.net>
Subject Re: [S2] AJAX with Sitemesh
Date Mon, 30 Jul 2007 12:52:27 GMT
On 7/30/07 2:06 AM, "Grish" <gin18em@hotmail.com> wrote:

> 
> I tried taking a modified version of the Struts 2 + Spring 2 + JPA + AJAX
> tutorial that I've done and integrated it with Sitemesh.
> 
> I realized that if i have div tags with the ajax theme, Sitemesh will
> decorate that area so I will end up with and embedded decorator in the main
> page. I need to exclude my AJAX calls from being decorated. I understand
> that Sitemesh has a decorators.xml where you can specify which urls are not
> to be decorated:
> 
>   <!-- Any urls that are excluded will never be decorated by Sitemesh -->
>   <excludes>
>     <pattern>/styles/*</pattern>
>     <pattern>/scripts/*</pattern>
>     <pattern>/images/*</pattern>
>     <pattern>/ajax/*</pattern>
>     <pattern>/dojo/*</pattern>
>     <pattern>/struts/*</pattern>
>     <pattern>/nodecorate/*</pattern>
>   </excludes>
> 
> I first thought I simply had to move my jsps to a folder that was part of
> the sitemesh excludes, like the ajax folder or the nodecorate folder. I have
> a page called person.jsp and when I list the results of my search using ajax
> I use the personList.jsp. I moved the personList.jsp to an excluded folder
> but Sitemesh still decorated my personList.jsp.

The exclusion is based on the requested URL, not where the file is in your
project.

This is what I did. I have two action definitions,


<action name=createPO" class="CreatePOAction" />
<action name="createPOAjax" class="CreatePOAction" />


Requests to createPO.action should be decorated, calls to
createPOAjax.action shouldn't.


<excludes>
    <pattern>*Ajax.action*</pattern>
</excludes>

I'm not sure if the second * is necessary, but it works. I also use one
class with two action definitions. I have methods that handle the Ajax stuff
in the same class file so everything is nicely contained and I use the
method argument to the request to call the specific method I want.

Take care,
Mark


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


Mime
View raw message