Data Provisioning Services for mobile clients - PowerPoint PPT Presentation

About This Presentation
Title:

Data Provisioning Services for mobile clients

Description:

Title: Data Provisioning Services for mobile clients Author: Mohit Agarwal Last modified by: yhhan Created Date: 1/31/2002 7:58:20 PM Document presentation format – PowerPoint PPT presentation

Number of Views:69
Avg rating:3.0/5.0
Slides: 45
Provided by: Mohi1
Category:

less

Transcript and Presenter's Notes

Title: Data Provisioning Services for mobile clients


1
14?. ??? ?? ? ? ??????? ??
2
1. Thumbnail ??? ???
  • ??? (thumnail) ???
  • ?? ???? ??? ?? ? ?? ??? ??? ?? ???? ?? ?? ???

Google ??? ??? ???? ??? ????
3
1. Thumbnail ??? ???
  • ??? (thumnail) ???? ??? ??
  • ??? ?? ?? ??
  • java.awt., java.awt.image., javax.imageio.,
    javax.swing. ? ?? ???? ??
  • ? ????? ??? ???? ??? ?? ?? ?? ????? ??
  • ?? ????? ?? ??? ????? ? ?? ?? ???.
  • ??? ??? ?? ?? ????? ?? ??? ????? ?? Java ??? ??
    ?? ? ??

4
1. Thumbnail ??? ???
  • ??? ???? ??? ????

?? 14.1 jspbook \ WEB-INF\java_sources\ImageUti
l.java
01 02 03 04 05 06 07 08 09 10 11 12 13 14 14 16 17 18 19 20 21 22 23 24 package thinkonweb.util import java.awt.Graphics import java.awt.Image import java.awt.image.BufferedImage import java.io.File import java.io.IOException import javax.imageio.ImageIO import javax.swing.ImageIcon public class ImageUtil public static final int HEIGHT 0 public static final int WIDTH 1 public static int getWidth(String img) Image imgSource new ImageIcon(img).getImage() return imgSource.getWidth(null) public static int getHeight(String img) Image imgSource new ImageIcon(img).getImage() return imgSource.getHeight(null)
5
1. Thumbnail ??? ???
  • ??? ???? ??? ????

?? 14.1 jspbook \ WEB-INF\java_sources\ImageUti
l.java
25 26 27 28 29 30 31 32 33 34 35 - 36 37 38 39 40 41 42 43 44 45 46 47 public static void createThumbnail(String img, String thumb, int size, int direction) throws Exception Image imgSource new ImageIcon(img).getImage() Image thumbSource null if (direction WIDTH) thumbSource new ImageIcon( imgSource.getScaledInstance(size, -1, Image.SCALE_SMOOTH)).getImage() else thumbSource new ImageIcon( imgSource.getScaledInstance(-1, size, Image.SCALE_SMOOTH)).getImage() BufferedImage bi new BufferedImage(thumbSource.getWidth(null), thumbSource.getHeight(null), BufferedImage.TYPE_3BYTE_BGR) Graphics g bi.getGraphics() g.drawImage(thumbSource, 0, 0, null) try if (img.endsWith("jpg")) ImageIO.write(bi, "jpg", new File(thumb)) else if (img.endsWith("gif")) ImageIO.write(bi, "gif", new File(thumb)) catch (Exception e) System.out.println(e)
6
1. Thumbnail ??? ???
  • ImageUtil ???? ? ?? ?? ??? ?? ??
  • ? ??? ?? ?? ??? ?? ???? ????? ??? ????? ???? ???
    ??? ??? ??? ???? ??.
  • ?, ?? ???? ?? ?? ??? 100?? ???? ? ???? ?? ???
    ???? ????.

ImageUtil.createThumbnail(imagePath, thumbPath, 100, ImageUtil.WIDTH) imagePath ??? ?? ?? ???? ?? ?? ??? 100?? ??? ??? ???? thumbPath ??? ????.
ImageUtil.createThumbnail(imagePath, thumbPath, 50, ImageUtil.HEIGHT) imagePath ??? ?? ?? ???? ?? ?? ??? 50?? ??? ??? ???? thumbPath ??? ????.
7
1. Thumbnail ??? ???
  • ?? ??? ???? ??? ??

?? 14.2 jspbook\ch14\imagesize.jsp
01 02 03 04 05 06 07 08 09 10 11 12 13 14 - 14 16 lt_at_ page contentType"text/htmlcharsetutf-8" gt lt_at_ page import"thinkonweb.util.ImageUtil" gt lthtmlgt ltheadgtlttitlegt?? ??? ?? ??lt/titlegtlt/headgt ltbodygt lt String imagePath application.getRealPath("/ch14/bridge.jpg") int imageWidth ImageUtil.getWidth(imagePath) // ???? ?? ??? ??? int imageHeight ImageUtil.getHeight(imagePath) // ???? ?? ??? ??? gt lth3gt?? ???lt/h3gt ltimg src"bridge.jpg" border"0"gtltbrgt lth3gt???? ?? ??? ??? ???lt/h3gt ltimg src"bridge.jpg" border"0" width"lt imageWidth/2 gt"gt // ?? ???? ?? ??? ???? ??? ???? ?? lt/bodygt lt/htmlgt
ltimg src"bridge.jpg" border"0" width"50"gt
8
1. Thumbnail ??? ???
  • ??? ???? ???? ??

?? 14.3 jspbook\ch14\thumb.jsp
01 02 03 04 05 06 07 08 09 - 10 11 12 13 14 14 16 lt_at_ page contentType"text/htmlcharsetutf-8" gt lt_at_ page import"thinkonweb.util.ImageUtil" gt lthtmlgt ltheadgtlttitlegt??? ??? ???lt/titlegtlt/headgt ltbodygt lt String imagePath application.getRealPath("/ch14/bridge.jpg") // ?? ???? ?? ??? ?? String thumbPath application.getRealPath("/ch14/thumb-bridge.jpg") //??? ?? ??? ??? ?? ImageUtil.createThumbnail(imagePath, thumbPath, 200, ImageUtil.WIDTH) // ?? ??? 200?? ??? ??? ???? thumbPath ??? ?? gt lth3gt?? ???lt/h3gt ltimg src"bridge.jpg" border"0"gtltbrgt lth3gt??? ???lt/h3gt ltimg src"thumb-bridge.jpg" border"0"gt lt/bodygt lt/htmlgt
9
2. ?? ??? ??
  • ?? vs. ?? ???
  • ?? (static) ???
  • ?? ? ??? ???? ?? ??? ???? ???
  • ?? (static) ???
  • ?? ??? ???? ?? ????? ??? ??? ?? ?? ? ??? ??? ????
    ???
  • ???? gif ?? jpg ??? ???? ????? ??? ? ?

10
2. ?? ??? ??
  • ?? ?? ??? ????
  • 1) JSP? ?? ??? ???? ?? ??? contentType ?? ??
  • 2) java.awt.image.BufferedImage ???? ?? ??
  • width? height ??? ??? ???? ??? ?? ??? ?
  • BufferedImage.TYPE_3BYTE_BGR? ?? (Blue), ??
    (Green), ?? (Red) ??? ??? ?? 1 ???? ? 3???? ????
    ??? ??
  • 3) BufferedImage ????? Graphics2D ??? ?? ????

lt_at_ page contentType"image/jpegcharsetutf-8" gt ?? lt_at_ page contentType"image/gifcharsetutf-8" gt
BufferedImage image new BufferedImage(width, height, BufferedImage.TYPE_3BYTE_BGR)
Graphics2D g image.createGraphics()
11
2. ?? ??? ??
  • ?? ?? ??? ????
  • 4) ??? ??? ??
  • 5) ImageIO ???? ?? write() ???? ????
    BufferedImage ??? response ??? ??????? ??? ?
    ?????? ???

g.setColor(Color.yellow) g.fillRect(0, 0, width, height) g.setColor(Color.blue) g.drawOval(10, 10, width-20, height-20) g.setFont(new Font("??", Font.BOLD, 25)) g.drawString("??! JSP", width/2 - 55, height/2 - 5)
ServletOutputStream outStream response.getOutputStream() ImageIO.write(image, "jpg", outStream) outStream.close()
12
2. ?? ??? ??
  • ?? ?? ??? ???? ??

?? 14.4 jspbook\ch14\dynamicImage.jsp
01 02 03 04 05 06 07 08 - 09 10 11 12 13 14 14 16 17 18 19 20 lt_at_ page contentType"image/jpegcharsetutf-8" gt lt_at_ page import"java.awt." gt lt_at_ page import"java.awt.image.BufferedImage" gt lt_at_ page import"javax.imageio.ImageIO" gt lt int width 300 int height 300 BufferedImage image new BufferedImage(width, height, BufferedImage.TYPE_3BYTE_BGR) // ???? ?? ??? image ?? Graphics2D g image.createGraphics() // image? ??? ?? ? ?? ?? g ?? g.setColor(Color.yellow) g.fillRect(0, 0, width, height) g.setColor(Color.blue) g.drawOval(10, 10, width-20, height-20) g.setFont(new Font("??", Font.BOLD, 25)) g.drawString("??! JSP", width/2 - 55, height/2 - 5) ServletOutputStream outStream response.getOutputStream() // ????? ????? ??? ?? ImageIO.write(image, "jpg", outStream) // ????? ?? ??? ?? outStream.close() gt
ltimg src"http//localhost8080/jspbook/ch14/dynamicImage.jsp" border"0" /gt
13
2. ?? ??? ??
  • ??? ????
  • 1) ?? URL? ???? ? ?? ???? ??? ?? ??
  • 2) bird.jpg? ???? BufferedImage ??? ???? ??

http//www.thinkonweb.com/jspbook/ch14/images/bird.jpg
BufferedImage image ImageIO.read(new URL("http//www.thinkonweb.com/jspbook/ch14/images/bird.jpg"))
14
2. ?? ??? ??
  • ??? ???? ??

?? 14.5 jspbook\ch14\compImage.jsp
01 02 03 04 05 06 07 - 08 09 10 11 12 13 14 14 16 17 lt_at_ page contentType"image/jpegcharsetutf-8" gt lt_at_ page import"java.awt." gt lt_at_ page import"java.net.URL" gt lt_at_ page import"java.awt.image.BufferedImage" gt lt_at_ page import"javax.imageio.ImageIO" gt lt BufferedImage image ImageIO.read(new URL("http//www.thinkonweb.com/jspbook/ch14/images/bird.jpg")) // ?? ???? image ?? ?? Graphics2D g image.createGraphics() // image? ??? ?? ? ?? ?? g ?? g.setColor(Color.black) g.setFont(new Font("??", Font.BOLD, 25)) g.drawString("??! JSP", 80, 50) ServletOutputStream outStream response.getOutputStream() // ????? ????? ??? ?? ImageIO.write(image, "jpg", outStream) // ????? ?? ??? ?? outStream.close() gt
15
3. ??? ?? ? ????
  • ??? ??? ??
  • Java2D ? Java3D ?? ???? ???? ??? ?? ????? ???
    ???? ??? ??? ???? ? ? ??.
  • ???, ?? ???? ???? ? ? ??? ???? ??? ? ?? ??????
    ??? ?? ??
  • JfreeChart ?? ?? ???? ?? ?????. ????? ???? ????
    ???.
  • JOpenChart ?? ??? ?? ?????. 0.94 ?? (2002?) ??
    ?? ?? ??? ??? ???? ??.
  • the Chart2D project (LGPL) ?? ??? ?? ?????.
    1.9.6 ?? (2002?) ?? ?? ?? ??? ??? ???? ??.
  • E-Gantt ???? (Scheduler)? ???? (Timeline) ??
    ??? ??? ??? ??? ???? ?? ?????. 2006??? ?? ??
    ?????? ???? ???? ??.
  • PtPlot ??? ??? ???? ?? ???? ???? ?? ???
    (Plotting) ?????

16
3. ??? ?? ? ????
  • JFreeChart? ?? ???
  • http//www.jfree.org/jfreechart
  • freeChart? ?? ?? ????
  • http//www.jfree.org/jfreechart/download.html
  • JFreeChart ???? ? ??
  • ??? ???? JFreeChart
  • http//blog.naver.com/mnk1231?RedirectLoglogNo1
    20056645547

17
3. ??? ?? ? ????
  • ??? ?? (Pie) ?? ???

piechart.jsp ???? ? ?? ????
18
3. ??? ?? ? ????
  • ??? ?? (Pie) ?? ???
  • 1) page ???? contentType? import? ??
  • 2) ???(??)? ?? ?? ? ??? ?? ??

lt_at_ page contentType"image/jpegcharsetutf-8" gt lt_at_ page import"org.jfree.data.general.DefaultPieDataset"gt lt_at_ page import"org.jfree.chart.JFreeChart"gt lt_at_ page import"org.jfree.chart.ChartFactory"gt lt_at_ page import"org.jfree.chart.ChartUtilities"gt
DefaultPieDataset dataset new DefaultPieDataset() dataset.setValue("One", new Double(43.2)) dataset.setValue("Two", new Double(10.0)) dataset.setValue("Three", new Double(27.5)) dataset.setValue("Four", new Double(17.5)) dataset.setValue("Five", new Double(11.0)) dataset.setValue("Six", new Double(19.4))
19
3. ??? ?? ? ????
  • ??? ?? (Pie) ?? ???
  • 3) ???(??) ??
  • 4) ??? ???(??)? ??? ??? ????? ??

JFreeChart chart ChartFactory.createPieChart( "Pie Chart in JSP", // ??? ?? dataset, // ??? ???? ??? ?? ?? true, // ? ???? ???? ??(legend) ?? ?? false, // ??(tooltip) ?? ?? java.util.Locale.getDefault() // ??? ?? )
ServletOutputStream outStream response.getOutputStream() ChartUtilities.writeChartAsJPEG( outStream, // ?? ??? chart, // ?? ??? ?? ?? ?? 300, 300 // ?? ???? ?? ?? ??? ) outStream.close()
20
3. ??? ?? ? ????
  • ??? ?? (Pie) ?? ???

?? 14.6 jspbook\ch14\piechart.jsp
01 02 03 04 05 06 07 08 09 10 11 12 13 14 - 14 16 17 18 lt_at_ page contentType"image/jpegcharsetutf-8" gt lt_at_ page import"org.jfree.data.general.DefaultPieDataset"gt lt_at_ page import"org.jfree.chart.JFreeChart"gt lt_at_ page import"org.jfree.chart.ChartFactory"gt lt_at_ page import"org.jfree.chart.ChartUtilities"gt lt DefaultPieDataset dataset new DefaultPieDataset() dataset.setValue("One", new Double(43.2)) dataset.setValue("Two", new Double(10.0)) dataset.setValue("Three", new Double(27.5)) dataset.setValue("Four", new Double(17.5)) dataset.setValue("Five", new Double(11.0)) dataset.setValue("Six", new Double(19.4)) JFreeChart chart ChartFactory.createPieChart("Pie Chart in JSP", dataset, true, false, java.util.Locale.getDefault()) // ?? ?? ?? ServletOutputStream outStream response.getOutputStream() ChartUtilities.writeChartAsJPEG(outStream, chart, 300, 300) outStream.close() gt
// JFreeChart ?????? ???? import
// ???? ??? ?? ???? ??
21
3. ??? ?? ? ????
  • ??? ?? (Pie) ?? ???
  • ?? ???? ??? ??? ?? ??? ??? ?? ??? ?? ??? ?? ??
    ???? ??
  • PiePlot ??? ??
  • setExplodePercent ???? ??? ??? ??? ???
  • ???? 0?? ??
  • setExplodePercent() ???? ? ?? ??
  • ?? ??? ?? ???? ??? ???? ??? ?? ??? ???? ???? ??

... lt_at_ page import"org.jfree.chart.plot.PiePlot"gt ... PiePlot plot (PiePlot)chart.getPlot() plot.setExplodePercent(0, 0.10)
22
3. ??? ?? ? ????
  • ??? ?? (Pie) ?? ???

?? 14.7 jspbook\ch14\piechart2.jsp
01 02 03 04 05 06 07 08 09 10 11 12 13 14 14 - 16 17 18 19 20 21 22 23 lt_at_ page contentType"image/jpegcharsetutf-8" gt lt_at_ page import"org.jfree.data.general.DefaultPieDataset"gt lt_at_ page import"org.jfree.chart.JFreeChart"gt lt_at_ page import"org.jfree.chart.ChartFactory"gt lt_at_ page import"org.jfree.chart.ChartUtilities"gt lt_at_ page import"org.jfree.chart.plot.PiePlot"gt // ?? ?? ?? ??? ?? PiePlot ??? import lt DefaultPieDataset dataset new DefaultPieDataset() dataset.setValue("One", new Double(43.2)) dataset.setValue("Two", new Double(10.0)) dataset.setValue("Three", new Double(27.5)) dataset.setValue("Four", new Double(17.5)) dataset.setValue("Five", new Double(11.0)) dataset.setValue("Six", new Double(19.4)) JFreeChart chart ChartFactory.createPieChart("Pie Chart in JSP", dataset, true, false, java.util.Locale.getDefault()) PiePlot plot (PiePlot)chart.getPlot() plot.setExplodePercent(0, 0.10) ServletOutputStream outStream response.getOutputStream() ChartUtilities.writeChartAsJPEG(outStream, chart, 300, 300) outStream.close() gt
// 0?? ?? ?? ??
23
4. ????? ? ?????? ?? (Deploy)
  • ????
  • ? ??????? ????? ?? ????? Tomcat ??? ?? ? ? ????
    ????.
  • ? ??????? ??? ???? ??? ????? ???? ??? ???? ??? ??
    ????.
  • JSP/Servlet? ?? ?? ??? ???? ?? ?? ???? ??? ??????
    ??? ? ??????? ?? ??? ?? ?? ????
  • ????? ??
  • ?? ????
  • Tomcat, Resin (Caucho Technology)
  • ?? ???? (???? ??? ?? ?? ?? ? ??? ?? ??)
  • JSP/Servlet ??? ???? J2EE ?? ???? ??? ?????? ???
  • Sun?? Java System Application Server
  • IBM? WebSphere Application Server
  • Oracle ?? Oracle Application Server (OAS)
  • Oracle Container for J2EE (OC4J), JBoss ?????? ??
    Jboss
  • BEA??? ?? Weblogic

24
4. ????? ? ?????? ?? (Deploy)
  • ????? ?? ??
  • ???? ? ??????? ???? ???? ???? ???? ?? ???? ????
    ??? ????? ??? ??
  • ?????? ???????? ??? ??
  • ?? (Deploy) ??
  • war (web application archive)??? ?? ??? ???
    ?????.

25
4. ????? ? ?????? ?? (Deploy)
  • ? ??????? ?? ? ?? ??

26
4. ????? ? ?????? ?? (Deploy)
  • war ??
  • ? ??????? ?? ?? ? ??? ?? ?? ?? ?? ??
  • Java?? ???? ????? jar? ???? ???? war ? ?? ???.
  • jar? ???? ?? ? (?? ?? winzip?? ??)??? war? jar??
    ???? ??? ? ? ??.
  • jar.exe? ??? war ?? ??
  • c ??? ??? ????.
  • v command??? ????? ?? ???? ????.
  • f ???? ??? ??? ????? ????.
  • jspbook.war ??? ??? war ?? ??? ????. ???? ?? ?
    ?????? ?? ??? ??? ?? ?? ????.

27
4. ????? ? ?????? ?? (Deploy)
  • ????? jspbook.war ?? ??

28
4. ????? ? ?????? ?? (Deploy)
  • Tomcat ?? war ??? ?? ??
  • 1) Tomcat ?? ?? ?? webapps ??? war ??? ???? ??
  • ????? ????? ?? ??
  • 2) Tomcat ??? ????? Tomcat Manager? ???? ??
  • ??? ?? war ??? ??? ? ??? ? ??? ?? ?? ??? ??? ? ??
    ??? ???? ??
  • Tomcat Manager ?? ??
  • Tomcat ?? ??? conf ?? ?? ?? tomcat-users.xml ??
    ??
  • admin ?? ??

lt?xml version'1.0' encoding'utf-8'?gt lttomcat-usersgt lt/tomcat-usersgt
lt?xml version'1.0' encoding'utf-8'?gt lttomcat-usersgt ltrole rolename"manager"/gt ltuser username"admin" password"jspbook" roles"manager"/gt lt/tomcat-usersgt
29
4. ????? ? ?????? ?? (Deploy)
  • Tomcat ?? ? ????? Tomcat Manager ??

30
5. ?? ???? web.xml? ??? ??
  • ?? ??? (Deployment Descriptor)? web.xml? ?? ??
  • ???? ? ??????? ?? ? ????
  • ??? ?? ? ??? ??? ?? ?? ??? ???? ??? ? ?? ???
    ????? ???? ??? ? ??????? ?? ??? ? ???? ???? ??
  • ??? ????? ??? ??
  • ? ??????? ??? ??? ?? ??? ????? ??? ??? ???? ? ?
    ?? ??? ?? ???? ?? ??? ??? ????? ???? ? ?????? ???
    ?? ??
  • ???? ??? ??
  • ? ??????? ??? ??? ??? ??? ???? ?????? ?? ??
    ?????? ??? ? ??? ???? ??? ???? ? ??????? ??
  • ???? ???? ?? ?? ??? ??? XML ??? ??? ??? ???? ???
    web.xml? ???? XML?? ?? ?? ????.

31
5. ?? ???? web.xml? ??? ??
  • web.xml? ?? ??
  • ltweb-appgt ?? ?? (Root Tag)
  • ltdescriptiongt ?? ? ltdisplay-namegt ??
  • ltdisplay-namegt? Tomcat Manager ?? ??? ???????? ??
    ? ??????? ??? ? ???? ??? ??

lt?xml version'1.0' encoding'utf-8'?gt ltweb-app xmlns"http//java.sun.com/xml/ns/javaee" xmlnsxsi"http//www.w3.org/2001/XMLSchema-instance" xsischemaLocation"http//java.sun.com/xml/ns/javaee http//java.sun.com/xml/ns/javaee/web-app_2_5.xsd" version"2.5"gt ... ... ... lt/web-appgt
ltdescriptiongt JSPBOOK Examples. lt/descriptiongt ltdisplay-namegtJSPBOOK Exampleslt/display-namegt
32
5. ?? ???? web.xml? ??? ??
  • web.xml? ?? ??
  • ltservletgt? ltservlet-mappinggt ?? (1/7)
  • Servlet? ?? ?? URL? "/controller/my.do"? ??? ???
    ?? ??
  • ? URL? ??? controller ?? ??? my.do?? ??? ?????
    ?????? ??? ??.
  • ?????? ? URL? ???? Servlet? thinkonweb.mvc.MyContr
    oller? ??? ??? ??? ??? ?? ? ?? ??? ??? ??? ?? ???.

ltservletgt ltservlet-namegtmyControllerlt/servlet-namegt ltservlet-classgtthinkonweb.mvc.MyControllerlt/servlet-classgt ltinit-paramgt ltparam-namegtpropFilelt/param-namegt ltparam-valuegttest.propertieslt/param-valuegt lt/init-paramgt lt/servletgt ltservlet-mappinggt ltservlet-namegtmuControllerlt/servlet-namegt lturl-patterngt/controller/my.dolt/url-patterngt lt/servlet-mappinggt
33
5. ?? ???? web.xml? ??? ??
  • web.xml? ?? ??
  • ltservletgt? ltservlet-mappinggt ?? (2/7)

34
5. ?? ???? web.xml? ??? ??
  • web.xml? ?? ??
  • ltservletgt? ltservlet-mappinggt ?? (3/7)
  • lturl-patterngt? lt/url-patterngt? ??? ? ?? ??? ??
  • ?? URL? lturl-patterngt ???? ?? ??
  • ?? 1) ???? ??? ? ????? ??? ???? lturl-patterngt ??
    ???? ??.
  • ?? 2) ???? ????? ???? lturl-patterngt ?? ??? ??.
  • ?? 3) ????? ???? ???? lturl-patterngt ?? ??? ????.
  • ?? 4) ?? ?? ??? ???? ?? lturl-patterngt ?? ????? ??
    ??? ???? ?? ??? ??.

1) ??? ????? ???? URL lturl-patterngt/controller/my.dolt/url-patterngt 2) ????? ???? URL, ?? ?? ? ?? ?? ????. lturl-patterngt/controller/lt/url-patterngt 3) ???? ???? URL lturl-patterngt.dolt/url-patterngt
35
5. ?? ???? web.xml? ??? ??
  • web.xml? ?? ??
  • ltservletgt? ltservlet-mappinggt ?? (4/7)
  • web.xml ? ??? ltservletgt? ltservlet-mappinggt ?? ?

ltservletgt ltservlet-namegtAlt/servlet-namegt ltservlet-classgtthinkonweb.foo.TestAlt/servlet-classgt lt/servletgt ltservlet-mappinggt ltservlet-namegtAlt/servlet-namegt lturl-patterngt.dolt/url-patterngt lt/servlet-mappinggt ltservletgt ltservlet-namegtBlt/servlet-namegt ltservlet-classgtthinkonweb.foo.TestBlt/servlet-classgt lt/servletgt ltservlet-mappinggt ltservlet-namegtBlt/servlet-namegt lturl-patterngt/foo/barlt/url-patterngt lt/servlet-mappinggt ltservletgt ltservlet-namegtClt/servlet-namegt ltservlet-classgtthinkonweb.foo.TestClt/servlet-classgt lt/servletgt ltservlet-mappinggt ltservlet-namegtClt/servlet-namegt lturl-patterngt/foo/lt/url-patterngt lt/servlet-mappinggt
36
5. ?? ???? web.xml? ??? ??
  • web.xml? ?? ??
  • ltservletgt? ltservlet-mappinggt ?? (5/7)
  • ??web.xml? ?? ?? URL? ?? ?
  • http//localhost8080/jspbook/list.do ?
    thinkonweb.foo.TestA (?? 3)
  • http//localhost8080/jspbook/foo/bar ?
    thinkonweb.foo.TestB (foo? bar? ?????? ???? ? ??
    2? ?? 4 ??)
  • http//localhost8080/jspbook/foo/bar/list.do ?
    thinkonweb.foo.TestC (?? 2)
  • http//localhost8080/jspbook/foo/list.do ?
    thinkonweb.foo.TestC (?? 2)
  • http//localhost8080/jspbook/bar/list.do ?
    thinkonweb.foo.TestA (?? 3)
  • http//localhost8080/jspbook/foo ?
    thinkonweb.foo.TestC (?? 2)
  • http//localhost8080/jspbook/foo/bar/view.goo ?
    thinkonweb.foo.TestC (?? 2)
  • http//localhost8080/jspbook/bar/view.goo ? 404
    FILE NOT FOUND ?? (???? Servlet ??? ??)

37
5. ?? ???? web.xml? ??? ??
  • web.xml? ?? ??
  • ltservletgt? ltservlet-mappinggt ?? (6/7)
  • web.xml ? ??? ltservletgt? ltservlet-mappinggt ??? ??
    ??? ?

ltservletgt ltservlet-namegtDlt/servlet-namegt ltservlet-classgtthinkonweb.foo.TestDlt/servlet-classgt lt/servletgt ltservlet-mappinggt ltservlet-namegtDlt/servlet-namegt lturl-patterngt/foo/barlt/url-patterngt lt/servlet-mappinggt ltservletgt ltservlet-namegtElt/servlet-namegt ltservlet-classgtthinkonweb.foo.TestElt/servlet-classgt lt/servletgt ltservlet-mappinggt ltservlet-namegtElt/servlet-namegt lturl-patterngt/foo/bar/lt/url-patterngt lt/servlet-mappinggt
38
5. ?? ???? web.xml? ??? ??
  • web.xml? ?? ??
  • ltservletgt? ltservlet-mappinggt ?? (7/7)
  • ??web.xml? ?? ?? URL? ?? ?
  • http//localhost8080/jspbook/foo/bar/ ?
    thinkonweb.foo.TestE (?? 2 ?? 4)
  • http//localhost8080/jspbook/foo/bar ?
    thinkonweb.foo.TestD (?? 2 ?? 4)

39
5. ?? ???? web.xml? ??? ??
  • web.xml? ?? ??
  • ltlistenergt ??
  • ltfiltergt ??

ltlistenergt ltdescriptiongtjspbook ?????? ???lt/descriptiongt ltlistener-classgtthinkonweb.listener.JspbookListenerlt/listener-classgt lt/listenergt
ltfiltergt ltfilter-namegtMultipartFilterlt/filter-namegt ltfilter-classgtthinkonweb.filter.MultipartFilterlt/filter-classgt lt/filtergt ltfilter-mappinggt ltfilter-namegtMultipartFilterlt/filter-namegt lturl-patterngt/ch20/register4.jsplt/url-patterngt lt/filter-mappinggt
40
5. ?? ???? web.xml? ??? ??
  • web.xml? ?? ??
  • ltwelcome-file-listgt ??
  • ?? ??? ?? http//www.google.com? ?? ? ?????? ????
    http//www.google.com/map? ?? ????? ??? ? ? ? ???
    ?? ?? ??? ???? ??
  • ?? ??? ??? ????? ??.
  • Note ????? ??? ?? ???? ?? Servlet ?? ???
    lturl-patterngt? ??? ??? ????? ????? ?? ??
  • ltcontext-paramgt ??

ltwelcome-file-listgt ltwelcome-filegtindex.htmllt/welcome-filegt ltwelcome-filegtindex.jsplt/welcome-filegt ltwelcome-filegtdefault.jsplt/welcome-filegt lt/welcome-file-listgt
ltcontext-paramgt ltparam-namegtappNamelt/param-namegt ltparam-valuegtjspbooklt/param-valuegt lt/context-paramgt
41
5. ?? ???? web.xml? ??? ??
  • web.xml? ?? ??
  • lterror-pagegt ??

lterror-pagegt lterror-codegt404lt/error-codegt ltlocationgt/ch11/error/404errorHandler.jsplt/locationgt lt/error-pagegt lterror-pagegt ltexception-typegtjava.lang.NullPointerExceptionlt/exception-typegt ltlocationgt/ch11/error/nullPointerErrorHandler.jsplt/locationgt lt/error-pagegt
42
5. ?? ???? web.xml? ??? ??
  • Servlet? ??? ?????
  • JSP ? Servlet? ?? ??? ???? ? ???? ??? ???.
  • ? ?????? ?? URL? ?? ????? ?? JSP? Servlet? ????
    ??? ? ??? ??? ???, ???? ??? ??, ??? (init() ??
    ??)? ?? ??? ??? ? ??? ?? ???? ??.
  • ??? ?? ??? ???? ?? ???? ??? ??? ? ??.
  • ??? ??? ??? ?? Servlet? ??? ?????

ltservletgt ltservlet-namegtmyControllerlt/servlet-namegt ltservlet-classgtthinkonweb.mvc.MyControllerlt/servlet-classgt ltload-on-startupgt1lt/load-on-startupgt lt/servletgt ltservletgt ltservlet-namegtincdeclt/servlet-namegt ltservlet-classgt/ch05/incdec.jsplt/servlet-classgt ltload-on-startupgt1lt/load-on-startupgt lt/servletgt
43
5. ?? ???? web.xml? ??? ??
  • server.xml? ? ?????? ?? ??
  • ???? ?? ??? ?? (DB ??)
  • Tomcat ??? ??? ?? ?? ?? ? ??? ??? ?? ??

ltResource name"jdbc/mysql" auth"Container" type"javax.sql.DataSource" username"root" password"jspbook" driverClassName"com.mysql.jdbc.Driver" url"jdbcmysql//localhost3306/jspbookdb?characterEncodingUTF-8" validationQuery"select 1" autoReconnect"true" maxActive"100" maxIdle"30" maxWait"3000" /gt
ltConnector port"8080" protocol"HTTP/1.1" connectionTimeout"20000" redirectPort"8443" URIEncoding"utf-8"/gt
44
5. ?? ???? web.xml? ??? ??
  • server.xml? ? ?????? ?? ??
  • ? ??????? webapps ??? ??? ?? ?? ?? ???? ????? ?
    ?? ?? ??

ltHost name"localhost" appBase"webapps" unpackWARs"true" autoDeploy"true" xmlValidation"false" xmlNamespaceAware"false"gt lt/Hostgt
ltHost name"localhost" appBase"webapps" unpackWARs"true" autoDeploy"true" xmlValidation"false" xmlNamespaceAware"false"gt ltContext path"/jspbook" docBase"d/myapps/jspbook" /gt lt/Hostgt
Write a Comment
User Comments (0)
About PowerShow.com