日期:2014-05-17  浏览次数:20675 次

命令空间问题
本人刚学struts,今天按照书上做了一个例子,但是却报关于命名空间的错误,而我并没有定义命名空间,还请各位高手帮忙帮忙,万分感谢。
login.jsp核心代码
 <s:form actiom="login" method="post">
   <s:textfield name="username" label="账号"></s:textfield>
   <br/>
  
   <s:password name="password" label="密码"></s:password>
  <br/>
  <s:submit value="提交"></s:submit>
  </s:form>

struts.xml核心代码

<struts>

<package name="ghyStruts1" extends="struts-default" >

<action name="login" class="controller.Login">
<result name="success">/true.jsp</result>
<result name="error">/false.jsp</result>
<result name="input">/login.jsp</result>
</action>

</package>

</struts>

报错:

2013-6-21 12:51:21 com.opensymphony.xwork2.util.logging.commons.CommonsLogger warn
警告: No configuration found for the specified action: '/login.jsp' in namespace: ''. Form action defaulting to 'action' attribute's literal value.


struts 登录 namespace

------解决方案--------------------
使用 <s:form > 标签的话, struts-xml文件中似乎要配置namespace=""  
<package name="ghyStruts1" extends="struts-default" > 在这里边配
------解决方案--------------------
你这个错误不是命名空间错误,而是struts把login.jsp当做action了,你是不是把缺省的action后缀名改成jsp了?
------解决方案--------------------
4楼说的对 
你应该是action 和Jsp 页面重名的问题吧 。
改个名称试试
------解决方案--------------------
【1】是“action”,不是“actiom”……
【2】建议单闭合 <s:textfield />

【3】是不是 web.xml 没有配置:

<filter-mapping>
<filter-name>struts</filter-name>
<url-pattern>*.jsp</url-pattern>
<filter-mapping>