This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Run an action servlet upon startup

 
Dave Alvarado
Ranch Hand
Posts: 436
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I'm using Struts 1.3. I have this action servlet defined in my struts-config.xml file ...

<action path="/refresh"
type="com.myco.regui.struts.refresh.RefreshAction"
scope="request"
validate="false">
</action>

The servlet takes no request parameters. How can I invoke the servlet automatically upon application startup? - Dave
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
App startup duties are generally handled by servlets or a plugin; is there any particular reason it needs to be an action?
 
Dave Alvarado
Ranch Hand
Posts: 436
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just code-reuse. I wanted to call an action -- /<ctx>/refresh.do an arbitrary points during my app's life cycle, but I also wanted to invoke the same functionality immediately upon application startup. I could also create a servlet and start it up in web.xml, but then I have two code bases that essentially do the same thing, so I was wondering if there was a way to merge the two.

- Dave
 
David Newton
Author
Rancher
Posts: 12617
IntelliJ IDE Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Whatever the action's logic is should be encapsulated in business logic anyway, no? If it's not web-related it doesn't belong in an action, IMO, although the web tier can *call* it.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic