You're correct, this is a user-list question. I'm not sure that you can dispatch to a non-servlet resource.
--- On Sun, 12/14/08, Dirk Forchel <dirk.forc...@exedio.com> wrote: > From: Dirk Forchel <dirk.forc...@exedio.com> > Subject: Re: ServletDispatcherResult (dispatcher) and forwarding to Actions > To: dev@struts.apache.org > Date: Sunday, December 14, 2008, 7:56 AM > Can somebody give me a helping hand or some advice > concerning the problem > mentioned below? > > > Dirk Forchel wrote: > > > > I know this might not be the right place for posting > my problem. Probably > > the Struts - User forum might be the better place. But > I don't get the > > feeling, that this issue is the right place for this > forum. > > Here is a short explanation about my yet unsolved > problem: > > > > First of all I use Struts 2.0.14, Tiles 2 and Tomcat > 6.0.16. > > I have a search form like ... > > > > <s:form action="search"> > > <s:textfield name="searchString" > value="%{searchString}"/> > > <s:submit /> > > </s:form> > > > > defined in a form.search.jsp which is included in > different pages > > (actually I use tiles 2), e.g. welcome.jsp, > product.jsp, category.jsp and > > on the search.result.jsp as well (which displays the > result list). > > I have a base action called ForwardAction which does > nothing more than > > rendering the HTML pages with all the used properties > and additionaly put > > each HTTP request on a defined stack (e.g. > /welcome.action, > > /category.action, /product.action, > /searchResult.action but not the > > actually search itself, cos this is not a > "forward"). The definition in > > struts.xml looks like > > > > <action name="welcome" > class="com.foo.ForwardAction"> > > <result > type="tiles">welcomePage</result> > > </action> > > > > The SearchResultAction extends the ForwardAction and > does some additional > > work with the search result list (pagination, sorting > etc.) > > > > <action name="searchResult" > class="com.foo.SearchResultAction"> > > <result > type="tiles">searchResultPage</result> > > </action> > > > > The search action itself is defined as > > > > <action name="search" > class="com.foo.SearchAction"> > > <result > type="redirect-action">searchResult</result> > > <result name="input" > type="dispatcher">${referer}</result> > > </action> > > > > and searches with the given search term for known > products on a database. > > Now my problem ... > > If a validation error occurs on my search form (a > missing search term), > > the ValidationInterceptor would intercept the action > invocation and would > > dispatch/forward to the ${referer} defined as > "input" result. My > > SearchAction implements the Prepareable interface and > set the "referer" > > property in my prepare method: > > > > @Override > > public void prepare() throws Exception { > > referer = request.getHeader( "Referer" ); > > if (referer==null) > > referer = request.getContextPath(); > > } > > > > If a validation error occurs on my welcome page, the > dispatcher should go > > to the welcome page (referer = > http://localhost:9001/welcome.action). If I > > have a validation error on the category page, the > dispatcher for the input > > result should go to > http://localhost:9001/category.action. If I search on > > my search result page with the same form and the same > search action the > > input dispatcher should go to > http://localhost:9001/searchResult.action. I > > think this is a quite common doing that on a web > application. > > But I got always the following HTTP 404 error. I > reckon this has something > > to do with the application server (in my case Tomcat > 6.0.16), the > > RequestDispatcher (ApplicationRequestDispatcher) and > the Servlet context > > path. If I use a context path "/" for my web > app, the error is the > > following. > > > > HTTP Status 404 - > //https:/localhost:9001/welcome.action > > > > type Status report > > > > message //https:/localhost:9001/welcome.action > > > > description The requested resource > > (//https:/localhost:9001/welcome.action) is not > available. > > > > If I use "" as context path, the resource > > "/https:/localhost:9001/welcome.action" is > not available. If I would > > return a "static" URL like > /jsp/pages/welcome.jsp the forward works fine. > > What could be wrong? Where do I miss the peace of > cake? > > > > In my web.xml I have the following filter definition: > > > > <filter> > > <filter-name>struts</filter-name> > > > > > <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class> > > </filter> > > > > <filter-mapping> > > <filter-name>struts</filter-name> > > <url-pattern>/*</url-pattern> > > </filter-mapping> > > > > Thank You for your help. > > > > -- > View this message in context: > http://www.nabble.com/ServletDispatcherResult-%28dispatcher%29-and-forwarding-to-Actions-tp20964129p21000068.html > Sent from the Struts - Dev mailing list archive at > Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: dev-unsubscr...@struts.apache.org > For additional commands, e-mail: dev-h...@struts.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@struts.apache.org For additional commands, e-mail: dev-h...@struts.apache.org