Servlet的体系结构|| Servlet相关配置
生活随笔
收集整理的這篇文章主要介紹了
Servlet的体系结构|| Servlet相关配置
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
Servlet的體系結構?? ?
?? ?Servlet -- 接口
?? ??? ?|
?? ?GenericServlet -- 抽象類
?? ??? ?|
?? ?HttpServlet ?-- 抽象類
?? ?* GenericServlet:將Servlet接口中其他的方法做了默認空實現,只將service()方法作為抽象
?? ??? ?* 將來定義Servlet類時,可以繼承GenericServlet,實現service()方法即可
?? ?* HttpServlet:對http協議的一種封裝,簡化操作
?? ??? ?1. 定義類繼承HttpServlet
?? ??? ?2. 復寫doGet/doPost方法
Servlet相關配置
urlpattern:Servlet訪問路徑
?? ??? ?1. 一個Servlet可以定義多個訪問路徑 : @WebServlet({"/d4","/dd4","/ddd4"})
?? ??? ?2. 路徑定義規則:
?? ??? ??? ?1. /xxx:路徑匹配
?? ??? ??? ?2. /xxx/xxx:多層路徑,目錄結構
?? ??? ??? ?3. *.do:擴展名匹配
? ? ? ? ? ? 注:前面不能加/ 即:
?
總結
以上是生活随笔為你收集整理的Servlet的体系结构|| Servlet相关配置的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: Servlet3.0 || IDEA与
- 下一篇: Request —— 获取请求行数据