天宇的JAVA空间站


web.xml讲解

2007-06-15 17:16Update
TAGS: web.xml | servlet

LifevV.COM编辑部

web.xml详解

Page:  <1|2>
web.xml例:
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
                         "http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app>
 <!-- [OPTIONAL] -->
 <icon>
     <small-icon>/myappLargeIcon.gif</small-icon>
     <large-icon>/myappLargeIcon.gif</large-icon>
 </icon>
 <!-- [OPTIONAL] -->
 <display-name>MyWebApp</display-name>
 <!-- [OPTIONAL] -->
 <description>This is a my first web-app</description>
 <!-- [OPTIONAL] 
     Notice: Objects in HttpSession must implement the Serializable interface for distributable
 -->
 <distributable />
 
 <!-- [OPTIONAL] 
     context parameter defination.
 -->
 <context-param>
  <param-name>MyContextParamName</param-name>
  <param-value>
    MyContextParamValue
  </param-value>
  <description>My context param name defination</description>
 </context-param>
   
 <!-- [OPTIONAL]
 -->
 <filter>
  <filter-name>MyAppFilter</filter-name>
  <filter-class>com.syboos.filter.MyAppFilter</filter-class>
  <init-param>
   <param-name>name</param-name>
   <param-value>some value</param-value>
  </init-param>
 </filter>


 <!-- [OPTIONAL]
 -->
 <filter-mapping>
  <filter-name>MyAppFilter</filter-name>
  <url-pattern>/*</url-pattern>
 </filter-mapping>

 <!-- [OPTIONAL]
 -->
 <listener>
  <listener-class>com.syboos.listener.MyContextListener</listener-class>
 </listener>
   
 <!-- [OPTIONAL]
 -->
 <servlet>
  <servlet-name>MyServlet</servlet-name>
  <servlet-class>com.syboos.myapp.MyServlet</servlet-class>
  <load-on-startup>1</load-on-startup>
 </servlet>
 
 <!-- [OPTIONAL]
 -->
 <servlet-mapping>
  <servlet-name>MyServlet</servlet-name>
  <url-pattern>/MyServlet/*</url-pattern>
 </servlet-mapping>

 <!-- [OPTIONAL]
 -->
 <session-config>
     <session-timeout>60</session-timeout>
 </session-config>
 
 <!-- [OPTIONAL]
 -->
 <welcome-file-list>
  <welcome-file>index.html</welcome-file>
  <welcome-file>index.jsp</welcome-file>
 </welcome-file-list>
 
 <!-- [OPTIONAL]
 -->
 <error-page>
  <error-code>404</error-code>
  <location>/404Error.html</location>
 </error-page>

 <!-- [OPTIONAL]
 -->
 <taglib>
  <taglib-uri>/WEB-INF/tld/MyTag.tld</taglib-uri>
  <taglib-location>/WEB-INF/tld/MyTag.tld</taglib-location>
 </taglib>

 <!-- [OPTIONAL]
 -->
 <ejb-local-ref>
  <ejb-ref-name>ejb/myEjbLocal</ejb-ref-name>
  <ejb-ref-type>Entity</ejb-ref-type>

  <local-home>com.syboos.ejb.MyEjbLocalHome</local-home>
  <local>com.syboos.ejb.MyEjbLocal</local>
  <ejb-link>MyEjbBean</ejb-link>
 </ejb-local-ref>
</web-app>


Page:  <1|2>
  • Relative Articles
 
Copyright ©2006-2010 lifevv.com. All Rights Reserved
POWERED BY @pmplat.syboos.com