Go No configuration found for the specified action solution

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.