谁能解释一下glassfish-web.xml、sun-web.xml和web.xml之间的主要区别(或提供一个链接
我可以只在我的网页应用中使用glassfish-web.xml,而跳过其他的吗?
发布于 2013-09-28 05:23:23
Java定义的
您可能需要也可能不需要web.xml文件。这取决于您使用的Java特性。默认情况下,不要使用这些文件中的任何一个,只需使用@WebServlet这样的Java注释。在构建应用程序并可能开始使用一些需要web.xml文件(如定义JavaServer Faces FacesServlet)的功能时,请使用web.xml文件。至于glassfish-web.xml,如果要为应用程序配置特定于GlassFish的特性,则只需使用一个。
Java教程也是学习Java的好方法,它与GlassFish 4一起与Java EE 7 SDK捆绑在一起。
发布于 2017-03-28 03:08:44
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_2_5.xsd" id="WebApp_ID" version="2.5">
<display-name>BusProject</display-name>
<welcome-file-list>
<welcome-file>login.jsp</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>spring</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>spring</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/spring-servlet.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
</web-app>https://stackoverflow.com/questions/19054371
复制相似问题