Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Struts2 "Initiation Servlet"

 
Z Sugiarto
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64683
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please be sure to ask Struts questions in the Struts forum. I have moved this post there for you.
 
Z Sugiarto
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
Z Sugiarto
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@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
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic