You can do the same with an application scope bean using spring . Create
a simple pojo that initializes values on the constructor. Then add an
entry to the applicationContext.xml file :
beans
bean id=myComp class=org.components.MyComponent singleton=true/
/beans
Then in your java action
Another option is to subclass the Struts 2 FilterDispatcher to perform
initializations:
public class YourAppDispatcher extends FilterDispatcher {
public void init(FilterConfig filterConfig) throws ServletException {
super.init(filterConfig);
// your initialization code here...
}
}
Hi,
In Struts 1, we were having an init servlet to load the application-wide
properties like dropdown values (from property files) into application
context and accessing these within JSP. Is there a better way of doing this
in Struts 2, and do we require an initialization servlet at all ? .
On 9/7/07, j alex [EMAIL PROTECTED] wrote:
In Struts 1, we were having an init servlet to load the application-wide
properties like dropdown values (from property files) into application
context and accessing these within JSP. Is there a better way of doing this
in Struts 2, and do we require
Hi Chris,
How is the ServletContextListener suited for my purpose ? . Can you please
elaborate a little more? . What i'm looking for is access to the properties
files' values and flags read from DB, not able to relate how this is related
to the listener.
Thanks,
Joseph
On 9/7/07, Chris Pratt
On 9/7/07, j alex [EMAIL PROTECTED] wrote:
How is the ServletContextListener suited for my purpose ? . Can you please
elaborate a little more? . What i'm looking for is access to the properties
files' values and flags read from DB, not able to relate how this is related
to the listener.
In
6 matches
Mail list logo