Re: Excluding decoration by request/response parameter/attribute

Joe Walnes <[email protected]> Tue, 21 Jun 2005 14:21:41 +0100
Newsgroups gmane.comp.web.sitemesh.general
Message-ID <[email protected]>
You could create your own DecoratorMapper that checks for a flag in
the request attributes.

public class MyDecoratorMapper extends AbstractDecoratorMapper {
  public Decorator getDecorator(HttpServletRequest request, Page page) {
    if (request.getAttribute("no-decorator") != null) {
      return null; // "no-decorator" attribute present... disable decorator
    } else {   
      return super.getDecorator(request, page); // otherwise behave as normal.
    }
  }
}

To deploy this, add the appropriate <mapper> entry to
WEB-INF/sitemesh.xml (if you don't already have this file, you can get
a template from sitemesh-default.xml, which lives inside
sitemesh.jar).

Then in your actions, you can do request.setAttribute("no-decorator",
Boolean.TRUE) to programatically disable decorators.

thanks
-Joe
On 6/9/05, Abdullah Jibaly <[email protected]> wrote:
> Hi all,
> 
> I've been looking for a way to stop decoration of a page that is by default decorated. Is there a way to do this in the action, by adding a request/response attribute for example? Otherwise, what is the best way to programatically exclude a page from decoration?
> 
> Thanks!
> Abdullah
> 
> ---------------------------------------------------------------------
> Posted via Jive Forums
> http://forums.opensymphony.com/thread.jspa?threadID=3165&messageID=8324#8324
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
> 
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]