Struts2 configuration successful

Source: Internet
Author: User

 

The structure is as follows:

Pom. xml

 <?  XML version = "1.0" encoding = "UTF-8"  ?>  <  Project  Xmlns  = "Http://maven.apache.org/POM/4.0.0"  Xmlns: xsi  = "Http://www.w3.org/2001/XMLSchema-instance"  Xsi: schemalocation  = "Http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"  >     <  Dependencymanagement  >          <  Dependencies  >              <  Dependency  >                  <  Groupid  > Org. Apache. Struts </  Groupid  >                  < Artifactid  > Struts2-core </  Artifactid  >                  <  Version  > 2.3.4.1 </  Version  >              </  Dependency  >              <  Dependency >                  <  Groupid  > Org. springframework </  Groupid  >                  <  Artifactid  > Spring-core </  Artifactid  >                  <  Version  > 3.1.2</  Version  >              </  Dependency  >              <  Dependency  >                  <  Groupid  > Org. springframework </  Groupid  >                  < Artifactid  > Spring-Web </  Artifactid  >                  <  Version  > 3.1.2 </  Version  >              </  Dependency  >          </  Dependencies >      </  Dependencymanagement  >  </  Project  > 

Web. xml

 <?  XML version = "1.0" encoding = "UTF-8"  ?>  <  Web-app  ID  = "Webapp_9"  Version  = "2.4" Xmlns  = "Http://java.sun.com/xml/ns/j2ee"  Xmlns: xsi  = "Http://www.w3.org/2001/XMLSchema-instance"  Xsi: schemalocation  = "Http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"  >      <  Display-name  > Tests2 </  Display-name  >      < Filter  >          <  Filter-name  > Struts2 </  Filter-name  >          <  Filter-class  > Org. Apache. struts2.dispatcher. Ng. Filter. strutsprepareandexecutefilter </  Filter-class  >      </ Filter  >      <  Filter-Mapping  >          <  Filter-name  > Struts2 </  Filter-name  >          <  URL-Pattern  > /* </  URL-Pattern >      </  Filter-Mapping  >      <  Welcome-file-list  >          <  Welcome-File  > Index.html </  Welcome-File  >      </  Welcome-file-list  > </  Web-app  > 

Struts. xml

 <?  XML version = "1.0" encoding = "UTF-8"  ?>  <!  Doctype struts public "-// Apache Software Foundation // DTD struts configuration 2.0 // en" "http://struts.apache.org/dtds/struts-2.0.dtd"  >  <  Struts  >      <  Constant Name  = "Struts. devmode"  Value  = "True"   />      <  Package  Name  = "Default"  Namespace  = "/"  Extends  = "Struts-Default"  >          <  Action  Name = "AAA"  >              <  Result  > /Index.html </  Result  >          </  Action  >              </  Package  >  </  Struts  > 

 

Note: accidentally write struts. XMLSTruts. XML, keep making mistakes, depressing

 

 

 

 

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.