ssh与dwr整合
我使用struts2/spring2.0/hibernate3.1整合一个web项目(test),一切正常。现在我想在原有的基础上整合dwr。
///////web.xml////////////
<context-param>
<param-name>contextConfigLocaltion</param-name>
<param-value>classpath:applicationContext.xml</param-value>
</context-param>
<servlet>
<servlet-name>dwr</servlet-name>
<servlet-class>org.directwebremoting.servlet.DwrServlet</servlet-class>
<init-param>
<param-name>debug</param-name>
<param-value>true</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>dwr</servlet-name>
<url-pattern>/dwr/*</url-pattern>
</servlet-mapping>
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>*.action</url-pattern>
</filter-mapping>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
//////////////////////////////////////////////////////
运行 http://localhost:8080/test/dwr/ (正常)
运行 http://localhost:8080/test/index.jsp页面则报错,错误如下:
<s:form action="LoginAction">
<s:textfield id="aname" name="admin.adminname" label="用户名"></s:textfield>
<s:password id="apassword" name="admin.adminpassword" label="密码"></s:password>
</s:form>
The Struts dispatcher cannot be found. This is usually caused by using Struts tags without the associated filter. Struts tags are only usable when the request has passed through its servlet filter, which initializes the Struts dispatcher needed for this tag. - [unknown location]
org.apache.struts2.views.jsp.TagUtils.getStack(TagUtils.java:60)
org.apache.struts2.views.jsp.StrutsBodyTagSupport.getStack(StrutsBodyTagSupport.java:44)
org.apache.struts2.views.jsp.ComponentTagSupport.doStartTag(ComponentTagSupport.java:48)
org.apache.jsp.index_jsp._jspx_meth_s_005fform_005f0(index_jsp.java:168)
org.apache.jsp.index_jsp._jspService(index_jsp.java:134)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
///////////////////////////////////////////////
把web.xml中的struts中的配置路径从 ”*.action“ 改写成 ”/*“
情况与上面反过来了
运行 http://localhost:8080/test/index.jsp/ (正常)
运行 http://localhost:8080/test/dwr/ 错误如下:
There is no Action mapped for action name dwr/.