У меня есть легкий легкий URL. Когда я набираю URL-адрес в браузере, java-класс get call возвращает результат. когда я вызываю файл index.html, он не загружается. я использую tomcat7
Это мой web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com /xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns
/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>projectname</display-name>
<resource-ref>
<description>MySQL Datasource example</description>
<res-ref-name>jdbc/projectnamedb</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<context-param>
<param-name>log4jConfigLocation</param-name>
<param-value>${catalina.home}\conf\log4j.properties</param-value>
</context-param>
<context-param>
<param-name>inputPropertiesLocation</param-name>
<param-value>${catalina.home}\conf\projectDetails.properties</param-value>
</context-param>
<context-param>
<param-name>resteasy.scan</param-name>
<param-value>true</param-value>
</context-param>
<listener>
<listener-class>org.jboss.resteasy.plugins.server.servlet.ResteasyBootstrap
</listener-class>
</listener>
<servlet>
<servlet-name>Resteasy</servlet-name>
<servlet-class>org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher
</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Resteasy</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>/index.html</welcome-file>
</welcome-file-list>
</web-app>
Ну, 2 вещи, чтобы знать здесь
1) Вы не можете набирать просто http://index.html
вам нужно http://index.html
путь к странице индекса, например http://projectname/path/to/index.html
2) Другой простой способ - добавить index.html
качестве страницы приветствия. Поэтому, когда сервер запускается, он сначала открывает страницу index.html
. как
<welcome-file-list>
<welcome-file>path/to/index.html</welcome-file>
</welcome-file-list>
WebContent
? Если да , то поместите index.html
в него и добавить страницу приветствия , как это <welcome-file>index.html</welcome-file>
web.xml
со страницей приветствия?