Skip to content

類別的名稱似乎有點小錯誤 #4

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion md/JavaTutorial.MD
Original file line number Diff line number Diff line change
Expand Up @@ -1434,7 +1434,7 @@ public class HelloWorld extends HttpServlet {
}
```

`Servlet` 繼承自 `javax.servlet.http.HttpServlet`,如果你要處理 `GET` 請求,就重新定義 `doGet` 方法,`javax.servlet.http.HttpServletRequest` 與 `javax.servlet.http.HttpServletRequest` 分別代表請求與回應物件,呼叫 `HttpServletRequest` 的 `getWriter` 取得輸出資料用的物件後,呼叫 `println` 方法就可輸出字串回應。
`Servlet` 繼承自 `javax.servlet.http.HttpServlet`,如果你要處理 `GET` 請求,就重新定義 `doGet` 方法,`javax.servlet.http.HttpServletRequest` 與 `javax.servlet.http.HttpServletResponse` 分別代表請求與回應物件,呼叫 `HttpServletResponse` 的 `getWriter` 取得輸出資料用的物件後,呼叫 `println` 方法就可輸出字串回應。

注意 `urlPatterns` 設定為 `"/hello.view"`,這表示資源的 URL 是 `/hello.view`,因此接下來,你只要執行 `gradle tomcatRunWar`,開啟瀏覽器請求 http://localhost:8080/BasicWeb/hello.view,就可以看到以下畫面:

Expand Down