警告: No configuration found for the specified action: 'checkLogin' in namespace: ''.的解决办法


    用struts2做了一个简单的入门程序,运行成功了,但是总出现这个警告:

警告: No configuration found for the specified action: 'checkLogin' in namespace: ''. Form action defaulting to 'action' attribute's literal value.

    虽说对系统的运行没什么影响,但是看着感觉很不舒服,所以想办法解决了。

     login.jsp页面的相关源码:

    <s:form action="checkLogin" method="post">
    <s:textfield name="username" label="用户名:"></s:textfield>
    <s:password name="password" label="密码:"></s:password>
    <s:submit value="登陆"></s:submit>
    </s:form>

    

     struts.xml的配置如下:

    <package name="struts" namespace="/" extends="struts-default">
      <action name="checkLogin" class="action.LoginAction" method="checkLogin">
        <result name="success">/index.jsp</result>
        <result name="login">/login.jsp</result>
      </action>
    </package>

 

      解决办法:在login.jsp页面的form标记里加上属性 namespace="/",即:
  <s:form action="checkLogin" method="post" namespace="/">
 

总之,这两个地方的namespace的属性值要一模一样,不能省略,否则就出现这样的警告。


 

  

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值