报错信息HTTP Status 500 - Unable to instantiate Action, org.ssh.product.action.ProductAction, defined for 'product_save' in namespace '/'org.ssh.product.action.ProductAction我的模型是package org.ssh.product.action;
……
@Controller //将这个action交给spring管理
@Scope("prototype") //作用域 为多实例
public class ProductAction extends ActionSupport {
……我的struts.xml是 <package name="product" extends="struts-default" namespace="/" strict-method-invocation="false">
<!-- 保存商品 -->
<action name="product_save" class="org.ssh.product.action.ProductAction" method="{1}Product">
<result>WEB-INF/view/index.jsp</result>
<result name="input">WEB-INF/view/index.jsp</result>
</action>
</package>我的spring 开启自动扫描了<context:component-scan base-package="org.ssh.*"/>我的web.xml <!-- 配置Struts2过滤器 -->
<filter>
<filter-name>struts2</filter-name>
<filter-class>org.apache.struts2.dispatcher.filter.StrutsPrepareAndExecuteFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!-- 配置Spring的监听器 -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
<!-- 指定Spring配置文件所在路径 -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationContext.xml</param-value>
</context-param>
添加回答
举报
0/150
提交
取消