1.Deployment Descriptor 配置
1.1Web.xml
ServletConfig参数配置:
配置地点:web-app->servlet->init-param
配置项:param-name ,param-value
java代码示例:getServletConfg().getInitParameter("adminEmail");
ServletContext参数配置:
配置地点:web-app->context-param
配置项: param-name,param-value
java代码示例:getServletContext().getInitParameter("adminEmail")
ServletContextListener类指定配置
配置地点:web-app->listener-;
配置项: listener-class
Session 存活时间配置
配置地点: web-app->session-config
配置项:session-timeout
Servlet配置
配置地点: 配置项
路径匹配:
web-app->servlet : servlet-name,servlet-class
web-app->servlet-mapping :servlet-name,url-pattern --> url-pattern 先识别完全匹配,再识别目录匹配,最后通配匹配,当多个目录匹配时,取最长匹配
预加载类:
web-app->servlet : load-on-startup 数字越小越先加载,同数字按dd出现顺序加载
欢迎页配置
web-app->welcome-file-list : welcome-file 顺序性
错误页配置
web-app->errorpage:error-code/type, location 如果是type要加入包名
MINE配置
web-app->mime-mapping: extension,mime-type
EJB
Reference to a local bean
<ejb-local-ref>
<ejb-ref-name>ejb/Customer</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<local-home>com.wickedlysmart.CustomerHome</local-home>
<local>com.wickedlysmart.Customer</local>
</ejb-local-ref>
Reference to a remote bean
<ejb-ref>
<ejb-ref-name>ejb/LocalCustomer</ejb-ref-name>
<ejb-ref-type>Entity</ejb-ref-type>
<home>com.wickedlysmart.CustomerHome</home>
<remote>com.wickedlysmart.Customer</remote>
</ejb-ref>
JNDI
<env-entry>
<env-entry-name>rates/discountRate</env-entry-name>
<env-entry-type>java.lang.Integer</env-entry-type> -->只要构造器是一个字符串变量就可以是任何类型
<env-entry-value>10</env-entry-value>
</env-entry>
Filter
<web-app>
<filter>
<filter-name></filter-name>
<filter-class></filter-class>
<init-param><param-name></param><param-value></param-value></init-param>
</filter>
<filter-mapping>
<filter-name></filter-name>
<url-pattern></url-pattern> caution :-->匹配时先匹配所有一般项,再匹配servlet项
<dispatcher>REQUEST/INCLUDE/FORWARD/ERROR</dispatcher>
</filter-mapping>
</web-app>
2.资源配置
2.1Common MIME types
text / html
application / pdf
application / java
application / jar
application / octet-stream
application / x-zip
image / jpeg
video / quicktime
3.部署
3.1 位置:
servlets :web-inf下的classes下
tag files :web-inf下或其子目录下的tags下或者jar包里面的meta-inf下或其子目录下的tags下
tld files : web-inf下或其子目录下或者jar包里面的meta-inf下或其子目录下