方式1.apache-tomcat-8.0.47\webapps文件夹下放war包会自动解压。文件夹名称就是访问路径
方式2.apache-tomcat-8.0.47\conf\Catalina\localhost问价夹下创建news.xml,访问路径后面就是 www.localhost:8080/news
其中news.xml的内容 。
<Context docBase="D:\BackPhoto\news"/>
其中D:\BackPhoto\news 下存放web资源,创建WEB-INF下新建web.xml文件,用来配置默认页面。
<?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
<welcome-file-list>
<welcome-file>a.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
</web-app>
如下:www.localhost:8080/news 和 www.localhost:8080/news/a.html 等价。
浙公网安备 33010602011771号