在使用struts2的时候,即使是运行正确,仍然会报出上述的错误。其实编程序有时候吧,并不是说会什么都在乎,只要运行结果是正确的,也很少有人去计较那么多,不过有些时候却很较真,有一个警告都觉得心里不安。
<body>
<s:form action="path/test">
<s:textfield name="msg" label="输入内容"></s:textfield>
<s:submit name="save" value="保存" method="save"></s:submit>
<s:submit name="print" value="打印" method="print"></s:submit>
</s:form>
</body>
只是简短的一小段代码,运行结果是正确的,但是却报了几个警告,
2012-4-11 14:08:45 com.opensymphony.xwork2.util.logging.jdk.JdkLogger warn
警告: No configuration found for the specified action: 'path/test' in namespace: ''. Form action defaulting to 'action' attribute's literal value.
2012-4-11 14:08:45 com.opensymphony.xwork2.util.logging.jdk.JdkLogger warn
警告: No configuration found for the specified action: 'path/test' in namespace: ''. Form action defaulting to 'action' attribute's literal value.
不知道自己哪里出了问题,通过看他人程序,发现去去除这些警告也很easy,
<body>
<s:form action="test" namespace="/path">
<s:textfield name="msg" label="输入内容"></s:textfield>
<s:submit name="save" value="保存" method="save"></s:submit>
<s:submit name="print" value="打印" method="print"></s:submit>
</s:form>
</body>
这样就不会出现那样的错误了,没有警告,看起来真是爽啊!