This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Struts and the fly likes Struts2 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Struts2 "Initiation Servlet"" Watch "Struts2 "Initiation Servlet"" New topic
Author

Struts2 "Initiation Servlet"

Zenikko Sugiarto
Ranch Hand

Joined: Jan 09, 2005
Posts: 58
All,

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!

Regards,
Zen.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60810
    
  65

Please be sure to ask Struts questions in the Struts forum. I have moved this post there for you.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Zenikko Sugiarto
Ranch Hand

Joined: Jan 09, 2005
Posts: 58
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
@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

So, Anyone?
David Newton
Author
Rancher

Joined: Sep 29, 2008
Posts: 12617

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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Struts2 "Initiation Servlet"
 
Similar Threads
web.xml problem in struts2
Struts2 with RAD7
errors.header in struts2
struts2 + interceptor
Default Action In Struts2