Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What are the Jar packages that must be provided with Struts2

2025-04-12 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

Editor to share with you which Jar packages must be equipped with Struts2. I hope you will get something after reading this article. Let's discuss it together.

Struts2.1.x has finally launched the official version. After download, it is configured according to Struts version 2.0.14. It throws an exception and says that it cannot be loaded (org.apache.struts2.dispatcher.multipart.MultiPartRequest). The exception message indicates that the org.apache.commons.fileupload.RequestContext class cannot be found. Search all the jar packages brought by struts2.1.6, and find that the RequestContext class is not in struts2-core-2.1.6.jar, but in the commons-fileupload-1.2.1.jar package. Previously, struts2.0.14 did not need this package, only if you want to use the upload component. It may be an improvement to the file upload function of struts2.1.6. Therefore, in order to use struts2.1.6 properly, you need at least 6 jar packages as follows:

Struts2-core-2.1.6.jar

Freemarker-2.3.13.jar

Commons-logging-1.0.4.jar

Ognl-2.6.11.jar

Xwork-2.1.2.jar

Commons-fileupload-1.2.1.jar

Note that the minimum jar package configuration for Struts 2.1.6 is one more commons-fileupload-1.2.1.jar than Struts2.0.14.

If you want to use the annotation function of Struts2, you only need to reference the struts2-core-2.1.6.jar file in Struts2.0.14, but you also need to reference the struts2-convention-plugin-2.1.6.jar file in struts2.1.6, and the package of the annotation class has changed (some new annotation classes have been added). The annotation class in Struts2.0.14 is in the org.apache.struts2.config package. The annotation class for struts2.1.6 is in the org.apache.struts2.convention.annotation package. In addition, the property names of some annotations have also changed. For example, Result annotations have a value attribute in struts2.0.14, which represents a URL to be transferred into, and

The location attribute is used instead of the value attribute in Struts2.1.6 's Result comments (there is no longer a value attribute), but they are used in the same way.

Therefore, when using Struts2.1.x, readers should be aware that this version is not fully compatible with Struts2.0.x (but for the most part). In my experience, the Struts2.1.x version will be a relatively stable Struts2 version, so it was only in the Struts1.1 version that Struts1.x became popular.

After reading this article, I believe you have a certain understanding of "what Jar packages are necessary to use Struts2". If you want to know more about it, please follow the industry information channel and thank you for your reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 211

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report