Dynamically setting the template directory in an Action

2011-11-10 Thread Chris Rijk
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

Struts 2 Initialization Plugin

2011-11-10 Thread Scott Smith
In struts 1, I used org.apache.struts.action.PlugIn as a way to create an object at web app startup and put it into the application context so that all sessions had access to it. What's the equivalent method in Struts2? That is, how can I have an object created at web application startup. I

Re: Struts 2 Initialization Plugin

2011-11-10 Thread Eric Reed
You should have an initialization servlet run at startup that can create such an object. Scott Smith ssm...@mainstreamdata.com 11/10/2011 3:06 PM In struts 1, I used org.apache.struts.action.PlugIn as a way to create an object at web app startup and put it into the application context so

Re: Struts 2 Initialization Plugin

2011-11-10 Thread Chris Pratt
Look into the ServletContextListener interface. It's a nice way to initialize/dispose of one-time resources in any web app, Struts or not. (*Chris*) On Thu, Nov 10, 2011 at 12:06 PM, Scott Smith ssm...@mainstreamdata.comwrote: In struts 1, I used org.apache.struts.action.PlugIn as a way to

Re: Struts 2 Initialization Plugin

2011-11-10 Thread Maurizio Cucchiara
You could take advantage of struts dependency injection [1]. You can use servlet filter or something else. Generally this kind of things are easy to realize thank to the interceptors facility. [1] http://struts.apache.org/2.x/docs/bean-configuration.html Maurizio Cucchiara On 10 November

Re: Struts 2 Initialization Plugin

2011-11-10 Thread Li Ying
I think lazy initialization is a simple choice, because it is not dependent on the J2EE container, this make your code easy to test. If you worry about duplicated-initialization triggered by multi request, the simple solution is, make your initialization code [synchronized], using reserved word

Re: Struts 2 Initialization Plugin

2011-11-10 Thread Ken McWilliams
The better solution is dependency injection with Spring, use the struts2-spring-plugin. On Thu, 2011-11-10 at 15:09 -0500, Eric Reed wrote: You should have an initialization servlet run at startup that can create such an object. Scott Smith ssm...@mainstreamdata.com 11/10/2011 3:06 PM

Re: Struts 2 Initialization Plugin

2011-11-10 Thread Ken McWilliams
The better solution is dependency injection with Spring, use the struts2-spring-plugin. On Thu, 2011-11-10 at 15:09 -0500, Eric Reed wrote: You should have an initialization servlet run at startup that can create such an object. Scott Smith ssm...@mainstreamdata.com 11/10/2011 3:06 PM