解决:No configuration found for the specified action

正确的做法:

 

 

 

<s:form action="hello" method="post" namespace="/xiva" name="hello">
    	<s:label>输入内容:</s:label><s:textfield name="msg"></s:textfield>
    	<s:submit value="submit"></s:submit>
   	</s:form>

 

 

 

	<package name="demo" namespace="/xiva" extends="struts-default">
		<action name="hello" class="org.xiva.struts2.demo.HelloAction">
			<result name="suc">/hello.jsp</result>
			<result name="fal">/errors.jsp</result>
		</action>
	</package>

 

错误的不给出了,主要是对namespace的处理,改完xml重启即可。

 

extends------->struts-default;来源于struts2的核心包!

action中的method属性,指明使用哪一个方法!

package中的abstract属性为true时,表示该包只能被继承,而没有action的实现!

 

对于action可以采用method匹配的方式!

 

<action name="reg_*" class="org.xiva.struts2.demo.bean.Register" method="{1}">
			<result name="success">/WEB-INF/mess/message.jsp</result>
			<result name="error" type="redirect">/errors.jsp</result>
		</action>	
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值