No configuration found for the s…

2010-3-9 14:56:15 org.apache.struts2.components.Form evaluateExtraParamsServletRequest
警告: No configuration found for the specified action: 'login' in namespace: ''. Form action defaulting to 'action' attribute's literal value.

或者

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

index.jsp:

<body>
    <s:form action="login"  namespace="/" >
      <s:textfield name="userName" label="用户名" /><br>   
      <s:password name="password" label="密码"/><br>   
      <s:submit value="登录"/>   
      </s:form>
</body>
struts.xml:

<struts>
    <package name="login" namespace="/" extends="struts-default">
        <action name="login" class="action.LoginAction">
            <result name="error">failed.jsp</result>
            <result name="success">success.jsp</result>
            <result name="input">login.jsp</result>
        </action>
    </package>
</struts>

web.xml:

<filter>
   <filter-name>struts2</filter-name>
   <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class>
</filter>
<!-- FilterDispatcher是struts2中的核心过滤器,它将过滤出所有符合要求的请求,然后进行struts2的内部处理 -->
<filter-mapping>
   <filter-name>struts2</filter-name>
   <url-pattern>/*</url-pattern>
</filter-mapping>
<welcome-file-list>
   <welcome-file>index.jsp</welcome-file>
</welcome-file-list>

web.xml中的就不多说了,就说下struts.xml和jsp页面吧!我先是在struts.xml中配置了namespace="/" 但是在页面上的form中没有配置namespace="/",然后运行就出现了:2010-3-9 14:56:15 org.apache.struts2.components.Form evaluateExtraParamsServletRequest
警告: No configuration found for the specified action: 'login' in namespace: ''. Form action defaulting to 'action' attribute's literal value.。

下面就总结下:

一:如果jsp页面用的struts2标签,则xml中有namespace,页面的form中也必须有namespace同时form提交时那个action可以直接写xml中的<action name="login" class="action.LoginAction">中的name属性的值,不需要加.action,如果有namespace的话

二:如果jsp页面用的struts1标签,则form提交时那个action必须写上action的绝对路径,如:/login.action,需要加.action,和namespace。

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值