SSH项目中,jQuery AJAX响应速度超慢,SiteMesh filter惹的祸

解决方案:
    避免用不到SiteMesh的AJAX请求被SiteMesh拦截,具体如下
   (1)给Struts2配两个后缀,如.do,.ajax
    (2)SiteMesh中只拦截后缀为.do的请求
    (3)不用SiteMesh的AJAX action请求以.ajax结尾
--------------------------------
配置文件改动:
(1)struts.xml
    <constant name="struts.action.extension" value="do,ajax"></constant>

(2)web.xml
	<!-- SiteMesh -->
	<filter>
		<filter-name>sitemesh</filter-name>
		<filter-class>com.opensymphony.module.sitemesh.filter.PageFilter</filter-class>
	</filter>
	<filter-mapping>
		<filter-name>sitemesh</filter-name>
		<url-pattern>*.do</url-pattern>
	</filter-mapping>

	<!-- Struts2 -->
	<filter>
		<filter-name>struts2</filter-name>
		<filter-class>org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter</filter-class>
	</filter>

	<filter-mapping>
		<filter-name>struts2</filter-name>
		<url-pattern>*.do</url-pattern>
	</filter-mapping>

	<filter-mapping>
		<filter-name>struts2</filter-name>
		<url-pattern>*.ajax</url-pattern>
	</filter-mapping>

你可能感兴趣的:(jquery,Ajax,xml,struts,ssh)