Getting started with struts2

Source: Internet
Author: User

Associate struts2 source code
When you associate struts2 source code with myeclipse, You can associate external folder with the following directory.
// Struts-2.0.11-All // Struts-2.0.11 // SRC // core // SRC // main // Java //

Added struts2 support
Copy the five most basic jar files of the struts2 framework toLib directoryOK
The name and size of the five jar packages are as follows:

Commons-logging-1.0.4.jar ------ 38kb
Freemarker-2.3.8.jar ------------ 784kb
Ognl-2.6.11.jar ------------------- 165kb
Struts2-core-2.0.11.jar --------- 2275kb
Xwork-2.0.4.jar ------------------- 446kb

Configure the struts2 Environment
ConfigureWeb. xmlFile to add the configuration and ing information of the struts2 core controller.
Then add the struts2 configuration fileStruts. xml, It should be savedWEB-INFInClassesDirectory
So we canSRCDirectoryStruts. xmlFile

The following is the Web. xml configuration:
<? XML version = "1.0" encoding = "UTF-8"?> <Br/> <web-app version = "2.5" <br/> xmlns = "" <br/> xmlns: xsi = "" <br/> xsi: schemalocation = " <br/>"> <br/> <filter-Name> struts2 </filter-Name> <br/> <Filter -Class> Org. apache. struts2.dispatcher. filterdispatcher </filter-class> <br/> <! -- The above is the filterclass used by strus2.0.11, and the following is the filterclass used by strus2.1.8.1 --> <br/> <! -- <Filter-class> Org. apache. struts2.dispatcher. ng. filter. strutsprepareandexecutefilter </filter-class> --> <br/> </filter> <br/> <filter-mapping> <br/> <filter-Name> struts2 </filter- name> <br/> <URL-pattern>/* </url-pattern> <br/> </filter-mapping> <br/> </Web-app>

The following is the Struts. xml configuration

<? XML version = "1.0" encoding = "UTF-8"?> <Br/> <! Doctype struts Public <br/> "-// Apache Software Foundation/DTD struts configuration 2.0/EN" <br/> ""> <br/> <struts> <br/> <package name = "struts2" extends = "struts-Default"> <br/> <action name = "login" class = "com. jadyer. action. loginaction "> <br/> <result name =" input ">/login. JSP </result> <br/> <result name = "failer">/login. JSP </result> <br/> <result name = "success">/result. JSP </result> <br/> </Action> <br/> </package> <br/> </struts> 

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