Today, I tried to build the struts2 environment and wrote the first –helloworld of the Struts program. The environment is set up very smoothly, mainly divided into 3 steps: Introduce jar package, write struts.xml, configure Web. Xml. For details, please refer to: http://www.blogjava.net/lzhidj/archive/2008/07/08/213445.html
But there is one problem: Tomcat can start successfully, but it is "this program cannot display Web pages". Post-Search Solutions:
Http://www.mamicode.com/info-detail-492134.html.
The main reason is that the server path of the Tomcat configuration is not the installation path for Tomcat, and you choose to use Tomcat installation. Deployment Path Select WebApps.
The problem really bothered me for a few hours.
In addition, there is the Web
<?xml version= "1.0" encoding= "UTF-8"?> <web-app xmlns:xsi= "Http://www.w3.org/2001/XMLSchema-instance" xmlns= "Http://xmlns.jcp.org/xml/ns/javaee" xsi:schemalocation= "Http://xmlns.jcp.org/xml/ns/javaee/http Xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd "id=" webapp_id "version=" 3.1 "> <display-name>struts</ display-name> <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-l ist> <context-param> <param-name>contextConfigLocation</param-name> <param-value>clas spath:applicationcontext*.xml</param-value> </context-param> <listener> <listener-class>o Rg.springframework.web.context.contextloaderlistener</listener-class> </listener> <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> </filte R-mapping> </web-app>
Both the
Listener and Fliter are written. The teacher in the presentation, also did not write, but there is no problem, doubt.