Common Errors and causes of java struts

Source: Internet
Author: User

1 exception javax. servlet. jsp. JspException: Cannot retrieve mapping for action/Login (/Login is your action name)
Possible cause: action is not defined in the struts-config.xml, or a matching action is not found, for example, using processing in a JSP file: if the preceding exception occurs, check the definition section in the struts-config.xml, you can use the struts console tool to check the error message.
2 exception org. apache. jasper. JasperException: Cannot retrieve definition for form bean null
Possible cause: this exception is because Struts does not find the form bean that action expects Based on the mapping in the struts-config.xml. In most cases, the reason may be that the name attribute set in form-bean does not match the name attribute set in action. In other words, action and form should each have a name attribute and must be exactly matched, including case sensitivity. This error occurs when no name attribute is associated with action. If the name attribute is not specified in action, no name attribute is associated with action. Of course, when an action creates some controls, for example, jump to the corresponding jsp page based on the parameter value, instead of processing form data, this does not require the name attribute, which is also one of the methods to use the action.
3 exception No action instance for path/xxxx cocould be created
Possible causes
Note: This error may occur in many cases. We recommend that you increase the log/debugging level of your web server, in this way, you can see more information about potential errors that occur when attempting to create an action class, which you have set Associations (that is, adding tags) in the struts-config.xml ).
The action class specified by the class attribute of the action tag in the struts-config.xml cannot be found for many reasons, such:
Failed to locate the compiled. class file. Failure to place compiled. class file for the action in the classpath (in web development, the class is located in the r WEB-INF/classes, so your action class must be in this directory. For example, if your action class is located in the WEB-INF/classes/action/Login. class, it is action. Login when setting the attribute type of action in the struts-config.xml ).
Spelling error. This also occurs from time to time and is not easy to find. Pay special attention to the case of the first letter and the name of the package.
The action class specified in the struts-config.xml does not inherit the Action class from Stuts, or your custom Action class does not inherit from the Action class provided by Struts.
Your action class must inherit from the Action class provided by Struts.
Your classpath problem. For example, web server does not find your resource file, the resource file must be under the WEB-INF/classes/directory.
4. Exception javax. servlet. jsp. JspException: No getter method for property username of bean org.apache.struts.taglib.html. BEAN
Possible causes
No variable in form bean defines the getter Method
This error occurs mainly in FormBean submitted by the form. When struts is used for marking, the FormBean must have a getUsername () method. Note the letter "U ".
5 Exception javax. servlet. jsp. JspException: Cannot find ActionMappings or ActionFormBeans collection
Possible causes
The tag that does not identify Struts actionServlet is the tag of the do ing. do extension, or neither of them is declared in web. xml.
Typing or spelling errors in the struts-config.xml can also lead to this exception. For example, a flag of the close symbol/> is missing. It is best to use the struts console tool to check.
In addition, load-on-startup must be in the web. declared in xml, this is either an empty tag or a value, which is used to indicate the priority of the servlet operation. The higher the value, the lower the priority.
Another issue related to the use of load-on-startup is that this exception may also occur when JSP files are pre-compiled using Struts.
6 Exception
Javax. servlet. jsp. JspException: Cannot find bean org.apache.struts.taglib.html. BEAN in any scope
Probable Causes
Try to use the child element of form outside the form tag of Struts. This often happens when you use the html Tag of Struts later.
In addition, pay attention to the non-subject tag that you may inadvertently use. For example, when parsing a web server, it is treated as a non-subject tag, all the subsequently used tags are considered to be out of this tag, such
When taglib is used to introduce the HTML Tag library, the prefix value you use is not

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.