struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Allistair Crossley" <Allistair.Cross...@QAS.com>
Subject RE: Infinite loop with action mappings
Date Fri, 06 May 2005 14:51:12 GMT
I found that by placing a direct jsp mapping to Tomcat's JSP servlet, I could accomplish what
I needed, so long as the URL is longer than the catch-all mapping as per the servlet spec.

    <servlet>
        <servlet-name>jsp</servlet-name>
        <servlet-class>org.apache.jasper.servlet.JspServlet</servlet-class>
        <init-param>
            <param-name>fork</param-name>
            <param-value>false</param-value>
        </init-param>
        <init-param>
            <param-name>xpoweredBy</param-name>
            <param-value>false</param-value>
        </init-param>
        <load-on-startup>3</load-on-startup>
    </servlet>
  	
   	<servlet-mapping>
      	<servlet-name>jsp</servlet-name>
		<url-pattern>/views/*</url-pattern>
	</servlet-mapping>  	
  	
   	<servlet-mapping>
      	<servlet-name>controller</servlet-name>
		<url-pattern>/*</url-pattern>
	</servlet-mapping>

> -----Original Message-----
> From: Allistair Crossley 
> Sent: 06 May 2005 15:11
> To: user@struts.apache.org
> Subject: Infinite loop with action mappings
> 
> 
> Hi,
> 
> I have a catch-all servlet mapping to push all requests to my 
> Struts controller in web.xml;
> 
> <servlet-mapping>
>   <servlet-name>controller</servlet-name>
>   <url-pattern>/*</url-pattern>
> </servlet-mapping>
> 
> I have 2 action mappings;
> 
> <action path="/view" forward="/views/layout.jsp"/>
> <action path="/**" type="com.blah.action.PageAction" />
> 
> When I request http://www.domain.com/view Struts finds the 
> action mapping and delegates a forward to /views/layout.jsp. 
> However, /views/layout.jsp is being picked up by the /* 
> servlet mapping in web.xml and being routed back to Struts. 
> This time because there is no action mapping for 
> /views/layout.jsp it goes to the wildcard action mapping and 
> that action's tile view is returned.
> 
> This causes an infinite loop in Struts.
> 
> Is this more to do with the servlet mapping, or is there 
> something I can instruct Struts to do with regard to getting 
> that JSP out to the response without causing another call to 
> the controller?
> 
> I need every request to go into the struts framework, but I 
> also need my JSPs to work inside struts which is not 
> happening right now due to this infinite loop.
> 
> Regards, Allistair
> 
> 2005-05-06 14:48:58,424 - DEBUG 
> (org.apache.struts.action.RequestProcessor:174) - Processing 
> a 'GET' for path '/view'
> 2005-05-06 14:48:58,424 - DEBUG 
> (org.apache.struts.action.RequestProcessor:992) -  Delegating 
> via forward to '/views/layout.jsp'
> 2005-05-06 14:48:58,424 - DEBUG 
> (org.apache.catalina.core.ApplicationDispatcher:143) - 
> servletPath=, pathInfo=/views/layout.jsp, queryString=null, name=null
> 2005-05-06 14:48:58,424 - DEBUG 
> (org.apache.catalina.core.ApplicationDispatcher:370) -  Path 
> Based Forward
> 2005-05-06 14:48:58,424 - DEBUG 
> (org.apache.struts.util.ModuleUtils:169) - Get module name for path 
> 2005-05-06 14:48:58,424 - DEBUG 
> (org.apache.struts.util.ModuleUtils:193) - Module name found: default
> 2005-05-06 14:48:58,424 - DEBUG 
> (org.apache.struts.action.RequestProcessor:174) - Processing 
> a 'GET' for path '/views/layout.jsp'
> 2005-05-06 14:48:58,424 - DEBUG 
> (org.apache.struts.config.ActionConfigMatcher:102) - 
> Attempting to match '/views/layout.jsp' to a wildcard pattern
> 2005-05-06 14:48:58,424 - DEBUG 
> (org.apache.struts.action.RequestProcessor:257) -  Looking 
> for Action instance for class 
> com.qas.newmedia.internet.core.page.action.PageAction
> 2005-05-06 14:48:58,424 - DEBUG 
> (org.apache.struts.action.RequestProcessor:271) -   Returning 
> existing Action instance
> 
> 
> <FONT SIZE=1 FACE="VERDANA,ARIAL" COLOR=BLUE> 
> -------------------------------------------------------
> QAS Ltd.
> Developers of QuickAddress Software
> <a href="http://www.qas.com">www.qas.com</a>
> Registered in England: No 2582055
> Registered in Australia: No 082 851 474
> -------------------------------------------------------
> </FONT>
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
> 
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message