`
tinguo002
  • 浏览: 25210 次
  • 性别: Icon_minigender_1
  • 来自: 福建
最近访客 更多访客>>
文章分类
社区版块
存档分类
最新评论

为No configuration found for the specified action疯狂了4个小时

阅读更多

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

因为这个错误我在 struts.xml 和 jsp页面之间修改了4个小时,不过最后我搞定他了。
虽然我还不明白原理是为什么,但并不妨碍我把这个可恶问题的解决过程同大家分享。

1.先把struts.xml 写成最简单的格式。


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

 


  <action name="login"  class="com.action.LoginAction">
   <result name="success"> /jsp/welcome.jsp </result>
  </action>


 </package>


-------------------

 

 

2.其次把  login.jsp 也改成最简单的格式。

 

  <body>


   <s:form action="login" method="post">
       <s:textfield  name="userName"  label= "用户名"> </s:textfield>
       <s:textfield  name="password"  label= "密码">    </s:textfield>
       <s:submit/>

   </s:form>


  </body>

现在我们可以重启服务了,应该不会再出现问题了。

可是!我如果必须加上 namespace 那又该如何做呢?

--------------------

3.在struts.xml  中加入 namespace="/xxx"  为什么要加3个X 呢 ?那是真的恨呀......

那么要正确的运行你必须在 login.jsp 里写

 

<s:form action="login" method="post" namespace="/xxx">

 

重启-运行;应该不会再有问题的。

但是如果你写成      <s:form action="/xxx/login.action" method="post"> 

依然会出错的,这点我就不明白了哈。

-------------------

4.最后我们再来看一下 这段错误

 

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

 

当我把 login.jsp 中的 action 值的变化为啥时 'login' 也就变化成啥

当我改变 login.jsp 的目录时, '/jsp'  就会改变  比如  WebRoot/jsp/xjsp/login.jsp 

那么就是 '/xjsp/jsp'.Form action defaulting ....... 

----------------

 

我还不知道如何能能代码像其它人样子贴出来   就像是在编辑器中的效果一样咯。(有谁知道的留言帮我一下哦)

所以看起来很不方便,希望能给痛苦中的人们一些用处哦哦

 

 

 

分享到:
评论
5 楼 HarryAlex 2011-04-04  
谢谢,学习了。
4 楼 lpxtx001 2011-03-09  
根据3楼的说法,我解决了这种问题,呵呵,谢谢各位老大
3 楼 jpsb 2010-11-05  
1.如果struts.xml中没有定义namespace
  <package name="default" extends="struts-default">
  则jsp中写为 <s:form action="login"> (不需要写namespace属性)
  此时控制台不会有警告信息。

2.如果struts.xml 定义了namespace
  <package name="default" extends="struts-default" namespace="/kongjian">
  则jsp中要这样写 <s:form action="login" namespace="/kongjian">
  此时控制台也不会有警告信息。

另外,我发现如果使用了namespace,页面中没有使用namespace属性<s:form name="login">...</s:form>的代码即使被注释掉,也仍然会有警告信息
 
2 楼 yeyeok 2010-09-28  
遇到同样的问题,还没搞定..
1 楼 l101y1982j 2010-04-27  
我来捧个人场

相关推荐

    BURNINTEST--硬件检测工具

    - Minor changes to the No operation error watchdog timer for the CD and Hard disk tests. - Minor correction to the Butterfly seek test. - Video playback trace logging increased. Release 5.3 build ...

    Java邮件开发Fundamentals of the JavaMail API

    Fundamentals of the JavaMail API Presented by developerWorks, your source for great tutorials ibm.com/developerWorks Table of Contents If you're viewing this document online, you can click ...

    OutlookAttachView v2.73

    o Added option to scan only emails with the specified 'From' and 'To' strings. * Version 1.82 o When adding a folder to scan (with the Add button), the folder path in now delimited with quotes, ...

    Turbo C 2.01[DISK]

    When /P is specified, the EGA palette will be restored each time the screen is swapped. In general, you don't need to use this switch unless your program modifies the EGA palette registers, or ...

    Turbo C 2.00[DISK]

    When /P is specified, the EGA palette will be restored each time the screen is swapped. In general, you don't need to use this switch unless your program modifies the EGA palette registers, or ...

    LCTF软件备份VariSpec™ Liquid Crystal Tunable Filters

    For this reason, the functions that handle these actions offer the option of waiting until the action is complete before returning (so-called synchronous operation); although they can be called in an ...

    FlexGraphics_V_1.79_D4-XE10.2_Downloadly.ir

    - FIX: In "Windows ClearType" font rendering mode (OS Windows mode) the "garbage" pixels can appear from the right and from the bottom sides of the painted rectangle of the TFlexText object....

    php.ini-development

    Please see the actual settings later in the document for more details as to why ; we recommend these changes in PHP's behavior. ; display_errors ; Default Value: On ; Development Value: On ; ...

    CE中文版-启点CE过NP中文.exe

    Fixed the found code dialog count size Fixed mono freezing Cheat Engine when it crashes/freezes Additions and changes: Changed the processlist and added an Applications view similar to the ...

    DebuggingWithGDB 6.8-2008

    4.1 Compiling for Debugging . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4.2 Starting your Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . ...

Global site tag (gtag.js) - Google Analytics