I would like to ask if there is a class in Struts2.1.6 that acts like a ServletContextListener? The reason why I'm trying to do this is I do have a values that would be fetched in the DB and I want it available in my entire application.
Another thing, if there is really a class for my question, how would I put it in my page(application scope)?
Of course, but that doesn't necessarily mean it'll work the way you think it will, but you don't really state what you're trying to accomplish, so it's hard to say. If you're trying to get the benefits of Spring integration, for example, it probably won't work--the container instantiates servlet context listeners, not Spring.
If you're trying to use Spring-oriented stuff there's an event interface you can implement then check for an application context startup message.
What are you trying to do?
Paul Michael Serrano
Joined: Nov 22, 2004
We are currently working on Struts2 framework only with version 2.1.6, we are not integrating it with Spring.
All I want to do, is to have a visibility of my ArrayList in my whole application. So I'm trying to do it like this...
I also put this snippet of code in my JSP, just to check if I'm getting it in my page. But unfortunately application.languageList is always null eventhough I've commented the DBconnection and force to put values in my ArrayList.
You're not saving anything to the application map, you're creating a *new* map and putting the value in that. Then you call the action's setter, and overwrite the reference to the actual application map.
I still don't understand why this needs to be an action if you're not doing anything related to Struts 2.