FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
JavaEE/HttpServlet_Hello.java at master · goder/JavaEE · GitHub
goder
JavaEE
Repository navigation
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
JavaEE
/
HttpServlet_Hello.java
Copy path
More file actions
More file actions
Latest commit
History
History
History
42 lines (28 loc) · 912 Bytes
Breadcrumbs
JavaEE
/
HttpServlet_Hello.java
Copy path
File metadata and controls
42 lines (28 loc) · 912 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*
* Servlet实现之第二种方式实现HttpServlet
*/
package
com
.
bj
.
servlet
;
import
java
.
io
.
PrintWriter
;
import
javax
.
servlet
.
http
.
HttpServlet
;
import
javax
.
servlet
.
http
.
HttpServletRequest
;
import
javax
.
servlet
.
http
.
HttpServletResponse
;
public
class
HttpServlet_Hello
extends
HttpServlet
{
//处理get请求
//req:用于获得客户端(浏览器)的信息
//res:用于向客户段(浏览器)的信息返回
public
void
doGet
(
HttpServletRequest
req
,
HttpServletResponse
res
){
//业务处理
try
{
PrintWriter
pw
=
res
.
getWriter
();
pw
.
println
(
"Hello ,HttpServlet!"
);
}
catch
(
Exception
ex
){
ex
.
printStackTrace
();
}
}
//处理post请求
//req:用于获得客户端(浏览器)的信息
//res:用于向客户段(浏览器)的信息返回
public
void
doPost
(
HttpServletRequest
req
,
HttpServletResponse
res
){
this
.
doGet
(
req
,
res
);
}
}
Back
|
FazBrowse Home
|
New Git URL