Using the struts tag library, the JSP page reports: Java. Lang. classnotfoundexception: COM. opensymphony. xwork2.util. textutils

Source: Internet
Author: User

My solution is:

Don't use xwork-2.1.6.jar, for xwork-2.1.2.jar!

 

The struts tag library is introduced in the JSP page: <% @ taglib prefix = "S" uri = "/Struts-tags" %>

Write a simple form,

 
<Div> <s: Form Action = ""> <s: textfield name = "username" label = "username"> </S: textfield> <s: textfield name = "password" label = "password"> </S: textfield> <s: Submit value = "login"> </S: Submit> </s: form> </div>

JSP error after running result: Java. Lang. classnotfoundexception: COM. opensymphony. xwork2.util. textutils

 

Literally, we already know the cause: the textutils class cannot be found.

 

Take a lookCodeNo error. OK. The code is correct. That's another code issue! There is only one possibility for the object: there is a problem with the imported jar package.

 

It is said that the jar package conflicts on the Internet. Textutils has been removed in the xwork-2.1.6.jar !!! OK. Can you download this class and add it manually? Use the most secure. The target is locked on the jar package of the xwork-2, so let's take a look at the version of this jar. Google still got the answer. textutils exists in the previous version. It is also speechless to remove this class from version 2.1.6 of Shenma High. Some people say that 2.1.8 is acceptable, but the JSON jar package must be involved. For example: http://blog.csdn.net/foart/article/details/6669836:

Find the following jar package in the Lib folder of the downloaded struts2:
Json-lib-2.x.jar
Struts2-json-plugin-2.x.x.jar
Struts2-junit-plugin-2.x.x.jar
Add the above three packages to the project, and then delete the jsonplugin-0.3x.jar package

 

I'm using a s2sh frame, struts2-core-2.1.6.jar + xwork-2.1.6.jar.

Since textutils has been removed from the xwork-2.1.6.jar, it cannot be used.

I personally think that the deletion of the jsonplugin-0.3x.jar package for a few more jar packages, and the version is basically getting higher and higher. This is not highly secure. If you change the environment, there may be other problems, even if this problem does not occur again. Of course, my simple and conservative practices may also face some version problems. Let's share them with you.

 

Don't use xwork-2.1.6.jar, for xwork-2.1.2.jar!

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.