struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ron Chan <>
Subject Struts2 startup service/action
Date Tue, 30 Sep 2008 09:16:30 GMT

There's been a number of messages about this, and I've tried a number of
different suggestions.  After going round in circles for a few days, I
eventually ended up with just a few lines of code that seems to work.  I
basically extended the FilterDispatcher, added to the init() method and used
the new FilterDispatcher in my web.xml instead.  This seems to work but I
was wondering if it would cause potential problems.  I use Guice and it
seems to work, have not  tested it with anything else.

public class ExtendedFilterDispatcher extends FilterDispatcher {
	public void init(FilterConfig filterConfig) throws ServletException {
		try {
			Container cont = super.dispatcher.getContainer();
			QuartzService service = (QuartzService) 
				ObjectFactory.getObjectFactory().buildBean(QuartzService.class, null);
		} catch (Exception e) {

QuartzService is an example, it can be any action or service controlled by
the struts objectfactory

View this message in context:
Sent from the Struts - User mailing list archive at

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message