• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Struts2 "Initiation Servlet"

 
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Sheriff
Posts: 67746
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Author
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
reply
    Bookmark Topic Watch Topic
  • New Topic