I remember doing this back in the days, but I can't seem to find a good and quick reference on the best way to do this. So here I am posting in the ranch forum.
I'm writing a web app using Struts2. What I needed is a way to call one of the Struts2 action when the web application is started.
I tried to find ways to bind a Struts2 action into the <servlet><load-on-startup /> declared in web.xml, but I can't seem to find a straightforward way to do it?
if you have better ways or a different suggestion, pleaselet me know. I am open for approach & ideas. Thanks!
ah, pardon me. I got misguided by the notion of <start-on-load> but you are correct, this is more slanted towards struts than pure servlet.
Anyone?
Zenikko Sugiarto
Ranch Hand
Joined: Jan 09, 2005
Posts: 58
posted
0
@bear
ah, pardon me. I think of <load-on-startup> and I think about servlet (web.xml) but you are correct, this is more slanted towards struts than pure servlet. Thanks for moving this into the appropriate section
Could you describe why you want to do this? Outside of a web request a Struts 2 action is kind of "context-free". An application startup listener of some sort is almost certainly more appropriate.