?15? Servlet???? - PowerPoint PPT Presentation

1 / 49
About This Presentation
Title:

?15? Servlet????

Description:

15 Servlet Java 2 15-1 Servlet 15-2 Servlet 15-1 ... – PowerPoint PPT presentation

Number of Views:123
Avg rating:3.0/5.0
Slides: 50
Provided by: edut1550
Category:
Tags: java | servlet

less

Transcript and Presenter's Notes

Title: ?15? Servlet????


1
?15? Servlet????
  • Java 2 ?????????

2
??
  • 15-1 Servlet???
  • 15-2 ??Servlet??
  • ????
  • ??????

3
15-1 Servlet???
  • 15-1.1 CGI?Servlet
  • 15-1.2 ?????Servlet??

4
??
  • ?????????????????,????????????!?????????,?????????
    ?????????,????????????????????,Servlet????????????
    ?

5
15-1.1 CGI?Servlet
  • ??????(Common Gateway Interafce,??CGI)?????????,?W
    WW???,???????????,???????????,CGI?????????????????
    ???????,??????????,??????????

6
????????
  • ??CGI????????Java?C???Visual Basic??
  • Servlet?????CGI???,??????????????,???Servlet??Ser
    ver?let????????,?Java?,let????????(???????Apple
    t??Application?let??????),???????????????????
    ?,????Servlet??????????????

7
15-1.2 ?????Servlet??
  • Java Servlet?????Servlet?WWW?????,??Servlet???Serv
    let??,???????????Servlet???

8
??????????Servlet Container??????
  • Apache?UNIX/Linux/Windows?????WWW???,?IIS?Windows?
    ????WWW???,????????????Servlet Container????(?????
    ????Resin??)

9
?????Resin?????????
10
(No Transcript)
11
(No Transcript)
12
(No Transcript)
13
(No Transcript)
14
(No Transcript)
15
(No Transcript)
16
(No Transcript)
17
(No Transcript)
18
(No Transcript)
19
(No Transcript)
20
???????????,????Resin??
  • ????????????http//localhost8080/,??????????,????
    Resin???

21
15-2 ??Servlet??
  • 15-2.1 ???Servlet??
  • 15-2.2 ???????

22
??
  • ???Servlet???,??Java Servlet????WWW????????,??????
    ??

23
15-2.1 ???Servlet??
  • Java Servlet???????HttpServlet???????Servlet?????,
    ?????????HTTP??????,????Java Servlet??????javax.se
    rvlet?javax.servlet.http????

24
Servlet?????
  • Servlet????????WWW???????,???Servlet?????Java
    Servlet,?service???doXXX????????(???service????,??
    ????doXXX??),?????????

25
???Servlet??????????
26
Servlet?????
  • ??doGet???????HttpServletRequest?HttpServletRespon
    se??????,?????ServletException?IOException????,???
    ??????(service?doXXX??????doGet??)

27
????????????
  1. HttpServletRequest???????????????,????????????
  2. HttpServletResponse???????????????,??????????HTM
    L???

28
???????
  • ??doGet????HttpServletResponse??,????PrintWriter??
    ,???????,?????????????,????????????

29
??????????????????
  • ???????????,?????????charsetBig5,??Big5??(????),
    ??res.setContentType("text/htmlcharsetBig5")?

30
??HttpServletResponse??????PrintWriter????,????
  • ??????????,?????HttpServletResponse??????PrintWrit
    er????,?????
  • ???????,???????????HTML??(??HTML????16-2.2)

31
????????
32
?????????
  1. ?2?3??????javax.servlet?javax.servlet.http????
  2. ?5??doGet????????????,?????service??????
  3. ?9???getWriter??????PrintWriter????,???1116??????
    ???HTML??,?????????
  4. ??PrintWriter????java.io???,????1????java.io????
  5. ?16???close?????????

33
???????????
  • Resin-2.1.16?????WWW???????C\resin-2.1.16\doc\
    WEB-I NF\classes,????Servlet??????????,???????????
    ???(Servlet????????.java)

34
???,??????
  • ???,???????,???classes??????.class??,???????????

35
(No Transcript)
36
(No Transcript)
37
15-2.2 ???????
  • ??Java Servlet?????HTML?????,????????????????,???
    ??????????????
  • ServletRequest????????????????????,???HttpServletR
    equest?????ServletRequest??,?????????ServletReques
    t??????
  • ???service?doXXX???,????ServletRequest??????

38
ServletRequest???????????
39
????????
40
(No Transcript)
41
?????????
  1. ?6??service?????????????
  2. ?10?11???HttpServletRequest??request??????t1?t2???
    ,???Double.parseDouble???????double?????
  3. ?13???????,???(??-100)0.9?
  4. ?1719??????????????,????2329??????????,????????

42
???????????HTML??,??????????????????
  • ???Java Servlet??,????C\resin-2.1.16\doc?????????
    HTML??,??????????????????(???Servlet?????),?????

43
(No Transcript)
44
?????????
  • ?6??ltformgt?????????get,???????Servlet?????/servle
    t/ch15_02_02?
  • ?8?10?????????,????t1?t2?
  • ?11?????????,???????????

45
???
  • ???,???????????(????HTML??????),???HTML??
  • ??????,???????????????,?????,??????Servlet??,?????
    ???????,??????

46
????-1
47
????-2
48
??????-???
49
??????-???
Write a Comment
User Comments (0)
About PowerShow.com