Hi all,

Referring to this page:
http://struts.apache.org/2.2.1/docs/selecting-template-directory.html

It says the template directory can be specified in the session, for example to 
allow the user to change it on a per-session basis. I've been trying to do this 
for my application, but can't get it to work.

I'm using the conventions library. If I copy WEB-INF/content to 
WEB-INF/content2 I can add a tag like @ResultPath(value="/WEB-INF/content2/") 
to an Action to change the template directory used to render the results, and 
this works as expected. However, that works on a per action/class basis, and I 
want to do it on a per session basis.

I've tried setting templateDir in the session but this has no effect. Any ideas?

For example, I've tried this in an action implementing the ServletRequestAware 
interface:

    public void setServletRequest(HttpServletRequest arg0) {
        HttpSession sess = arg0.getSession(true);
        sess.setAttribute("templateDir", "/WEB-INF/content2/");
    }

I also tried implementing SessionAware, eg:
    public void setSession(Map<String, Object> session) {
        session.put("templateDir", "/WEB-INF/content2/");
    }
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@struts.apache.org
For additional commands, e-mail: user-h...@struts.apache.org

Reply via email to