No configuration found for the specified action

警告: No configuration found for the specified action: 'ShowMessage' in namespace: ''. Form action defaulting to 'action' attribute's literal value.
2008-9-6 11:35:47 org.apache.struts2.components.Form evaluateExtraParamsServletRequest
警告: No configuration found for the specified action: 'ShowMessage' in namespace: ''. Form action defaulting to 'action' attribute's literal value.

=============================== 华丽的分割线 ===============================
处理办法:
                   JSP正确写法         
                    <s:form method="post" action="test1!add" namespace="/test">


                    struts.xml的正确配置
                    <struts>
                            <package name="default" namespace="/test" extends="struts-default">
                                    <action>
                                       …………
                                    </action>
                            </package>
                    </struts>


原因分析:
                    使用的struts2标签<s:form>,并且未指定namespace属性。
                    所以struts2会默认从根命名空间"/" 搜索action 。
                    在默认命名空间中是肯定找不到自己定义的action的,
                    所以,struts2抛出一个警告信息。
                     指定namespace后,struts2会在指定的“/.....”命名空间找。
                     当然,如果在这个命名空间里找不到请求的action,也会抛出一条类似的信息。

注意!
             <s:form name="name" method="post" action="test" namespace="/test" >
不能写成
             <s:form name="name" method="post" action="test.action" namespace="/test" >

                   
struts2会为我们自动补全的,无需手动添加,就不用多此一举了。
当然在其他地方,比如超链接,可以加.action。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值