Hi team, 

I haven't been active lately but still *use* struts2 daily. 
After recently upgrading from 2.1 to 2.3.1.1 I noticed the new Sitemesh 
integration (https://issues.apache.org/jira/browse/WW-3296).

The new documentation instructs users to include both the StrutsPrepareFilter 
and the StrutsListener in web.xml 
(http://struts.apache.org/2.3.1.1/docs/sitemesh-plugin.html)
This appears to be an attempt to get a Dispatcher into the ServletContext.

As documented however, instead this results in the creation of two Dispatchers 
and PrepareOperations. One by the init method of the filter, one by the 
listener; I think the one in the ServletContext is a different instance than 
the one used by the filter.  This is evident in my test application because the 
xml configuration is read twice. The application operates okay.

This was previously raised as an issue by Wes, Rene and others on struts-dev on 
around 20 February 2011 (that the filter doesn't/can't check if the Dispatcher 
was created by the listener if present).
http://struts.1045723.n5.nabble.com/getting-the-container-or-Configuration-ConfigurationManager-in-a-non-container-instantiated-object-td3526628.html
It doesn't appear that that resulted in any changes to the filter though.

Is the documentation incorrect, or should the Filter in this case be getting 
the PrepareOperations/Dispatcher from the servlet context (which is going be 
really messy)?

Sorry I didn't keep up with the sitemesh integration discussion. 

Regards, 
Jeromy Evans



Reply via email to