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

How to install and configure WebWork

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article mainly introduces how to install and configure WebWork. It is very detailed and has a certain reference value. Friends who are interested must read it!

Let's start with WebWork installation and WebWork configuration.

Overall, the framework is really simple and easy to use.

The interceptor mechanism is very distinctive.

Instead of writing ActionForm directly, the framework can directly generate response data encapsulation objects according to form naming and pass them to action, which is simpler and more convenient than struts.

Since the framework evolved from xwork, it is as separate from the api of the web container as possible.

It provides corresponding encapsulation access to all servlet built-in objects, which reduces direct access to servlet api and facilitates that one day the application may be ported to an environment that is not based on servlet api S structure.

It's still a good framework.

Some important points of knowledge:

1. Install and download WebWork.

Copy\ webwork-2.1.X.jar and\ lib\ core\ * .jar (the core class library used by WebWork2) to the WEB-INF\ lib directory of the Web application to complete the WebWork installation.

2. WebWork configuration process. Add the following servlet configuration to the / WEB-INF/web.xml file of the web application (basically every framework has such a servlet)

< servlet > < servlet-name > webwork < / servlet-name > < servlet-class > com.opensymphony.webwork.dispatcher. ServletDispatcher < / servlet-class > < / servlet > < servlet-mapping > < servlet-name > webwork < / servlet-name > < url-pattern > * .action < / url-pattern > < / servlet-mapping >

3. If you need to use the ui tag of webwork in the page, you should also add a WebWork configuration of the tag library to copy the webwork.tld to the appropriate directory

< taglib > < taglib-uri > webwork < / taglib-uri > < taglib-location > / WEB-INF/webwork.tld < / taglib-location > < / taglib >

4. Create another important configuration file for the framework, xwork.xml, in the\ WEB-INF\ classes directory

This file defines the corresponding Action class. Including result forwarding and placement, various interceptors, etc., see the example of webwork

5. Put the verification file validators.xml in the\ WEB-INF\ classes directory

The verification file of a specific class is placed in the same directory as the class class. Note the naming format: class name-validation.xml

Summarize the problems encountered in learning:

1. When configuring xwork.xml, WebWork accidentally put the interceptor in the wrong position and put it outside the tag. As a result, there are always errors, and the error message is not obvious, which has been messing around for a long time. Note that the interceptor must be placed between the tags in the future. Alas, it is troublesome to configure things all the time.

2. About client verification:

Pay attention to the version of webwork.

These are all the contents of the article "how to install and configure WebWork". Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!

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: 0

*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