Here is my riddle: Why does a dispatch forward to an absolute URL-path e.g. "http://localhost:9001/welcome.action" not work. Using a relative URL like "/welcome.action" doesn't work either. Only something dispatch forwards like "/jsp/pages/welcome.jsp" or similiar (a relative URL with a JSP resource) works for me. But I wanna use Tiles and therefore a forward to an "Action" rather than a JSP. I have a search form included in various and different pages (different JSPs and Tiles-definitions). If input validation fails on my search action, the field error should be displayed on the same page the input error occured. The seach form is used on almost every page of my web application. This problem drives me almost insane!!! Everyone can test it by yourself. Here is my Test-Configuration (without Tiles) and almost the complete code:
struts.xml: <struts> <package name="demostore" extends="struts-default"> <default-interceptor-ref name="paramsPrepareParamsStack"/> <default-action-ref name="welcome"/> <global-results> <result name="input">${referer}</result> </global-results> <action name="search" class="com.foo.SearchAction"> <result>/jsp/pages/search.result.jsp</result> </action> <action name="*" class="com.foo.action.ForwardAction"> <result>/jsp/pages/{1}.jsp</result> </action> </package> </struts> BaseAction.java: public class BaseAction extends ActionSupport implements ServletRequestAware, Preparable { private String referer; protected HttpServletRequest request; @Override public void setServletRequest(HttpServletRequest request) { this.request = request; } @Override public void prepare() throws Exception { referer = request.getHeader( "Referer" ); if (referer==null) referer = request.getContextPath(); } public String getReferer() { // THIS WORKS // return "/jsp/pages/welcome.jsp"; // THIS DOES'NT WORK // return "/welcome.action"; // THIS DOESN'T WORK EITHER return referer; } } ForwardAction.java: public class ForwardAction extends BaseAction { public String execute() throws Exception { addToHistory(getServletRequest()); return executeInternal(); } protected void addToHistory(HttpServletRequest request) { // Request History // History.addEntry(request); } protected String executeInternal() throws Exception { // forward actios should overwrite this method and do some additional work return SUCCESS; } } SearchAction.java: public class SearchAction extends BaseAction { private String searchString; public String execute() throws Exception { // DO SOME SEARCH return SUCCESS; } public void setSearchString(String searchString) { this.searchString = searchString; } public String getSearchString() { return searchString; } } welcome.jsp: ... <html> <head> <title>Welcome</title> </head> <body> Welcome <s:include value="form.search.jsp" /> </body> </html> form.search.jsp: ... <s:form action="search"> <label for="searchString"> <s:text name="search.term"/> </label> <s:textfield name="searchString" /> <s:submit key="search.submit" /> </s:form> SearchAction-validation.xml: ... <validators> <field name="searchString"> <field-validator type="requiredstring"> <message key="error.searchstring.required"/> </field-validator> </field> </validators> That's it. So where is the error? -- View this message in context: http://www.nabble.com/Christmas-Riddle-tp21088385p21088385.html Sent from the Struts - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@struts.apache.org For additional commands, e-mail: user-h...@struts.apache.org