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 = "http://java.sun.com/xml/ns/javaee" <br/> xmlns: xsi = "http://www.w3.org/2001/XMLSchema-instance" <br/> xsi: schemalocation = "http://java.sun.com/xml/ns/javaee <br/> http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"> <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/> "http://struts.apache.org/dtds/struts-2.0.dtd"> <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>