Using Struts2, configuring everything is OK, using common tag is OK, but when using <s:form> tag, the console always outputs a warning message.
The warning message reads as follows:
Warning:......
<div>
Hello World
<s:form name= "ShowMessage" method= "POST"Action= "/hello/showmessage.Action ">
<s:textfield label= "User name" Name= "username" ></s:textfield>
<s:submit></s:submit>
</s:form>
</div>
......
The Struts.xml configuration is as follows:
......
<struts>
<package name= "Hello" extends= "Struts-default" namespace= "/hello" >
<Action name= "ShowMessage" class= "Com.historycreator.strutstest.ShowMessage" >
<result>/digg/showmsg.jsp</result>
</Action>
</package>
</struts>
The above exception occurs when you open the Showmsg.jsp page. Various configuration and access methods have been attempted, and warnings are presented. The answer to the search network almost always says to put <s:form name= "ShowMessage" method= "POST"Action= "/hello/showmessage.Action "in the >.The action is removed and the test is done, and the problem is still unresolved. More people let the <s: remove, do not tag, direct write <form> This of course there is no problem, but one will be marked, one will not use, very messy, and is not the fundamental way to solve the problem.
Workaround:
After testing found that is not the correct use of tag reason, in this case, the correct wording should be, <s:form name= "ShowMessage" method= "POST"action= "ShowMessage" namespace= "/hello" >
Cause Analysis:
Because the beginning of the use ofThe Struts2 label (form) does not specify the namespace property. SoSTRUTS2 will default from the root namespace "/" SearchAction '/hello/showmessage.Action ', such as a search for an action string that is not found in the default namespace ', is certainly not found in the default namespace, soStruts2 throws a warning message.
Now that we have specified namespace as/hello, Struts2 will look directly at the/hello namespace. As you can imagine, if the requested action is not found in this namespace , a similar message is thrown.
Note that <s:form name= "ShowMessage" method= "POST" action= "ShowMessage" namespace= "/hello" >
cannot be written as <s:form name= "ShowMessage" method= "POST" action= "showmessage. Action "namespace="/hello ">
This still has the corresponding warning message, and the result is inaccessible after submission. Because there is no showmessage. action Such an action, this. Action cannot be added manually by us,Struts2 will automatically do the work for you, and manually add it is not possible, you do not have to superfluous. But on other occasions, such as using hyperlinks, you can add this. action.
Go No configuration found for the specified action solution