问答详情
源自:4-4 Action类交给Spring创建-Struts2整合Spring

Unable to instantiate Action, produceAction, defined for 'produce_save' in namespace '/'produceAction

<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE struts PUBLIC
	"-//Apache Software Foundation//DTD Struts Configuration 2.3//EN"
	"http://struts.apache.org/dtds/struts-2.3.dtd">

<struts>
	
   <package name="ssh"  extends="struts-default">
   	<action name="produce_*" class="produceAction" method="{1}"></action>
   </package>
</struts>
<bean id="produceAction" class="cn.muke.ssh.action.ProduceAction" scope="prototype">
		<property name="produceService" ref="produceService"></property>
	</bean>

	<bean id="produceService" class="cn.muke.ssh.service.ProduceService">
		<property name="dao" ref="dao"></property>
	</bean>
	<bean id="dao" class="cn.muke.ssh.dao.ProduceDao">
	</bean>
<s:form action="produce_save" method="post"  theme="simple">
	<table border="1" width="400">
		<tr>
			<td>商品名称:</td>
			<td><s:textfield name="pname"></s:textfield></td>
		</tr>
		<tr>
			<td>商品价格:</td>
			<td><s:textfield name="price"></s:textfield></td>
		</tr>
		<tr>
			<td colspan="2"><input type="submit"value="添加"></td>
		</tr>
	</table>
</s:form>


提问者:579末班车 2017-08-22 16:25

个回答

  • weibo_皇者农药_0
    2017-11-04 17:15:27

    我要是这个bug,你解决了吗

  • 小灰灰的大裤衩
    2017-08-22 17:44:45

     <package name="ssh"  extends="struts-default">改为

    <package name="ssh"  extends="struts-default" namespace="/">