Đang chuẩn bị liên kết để tải về tài liệu:
Java Server Pages: A Code-Intensive Premium Reference- P16

Đang chuẩn bị nút TẢI XUỐNG, xin hãy chờ

Java Server Pages: A Code-Intensive Premium Reference- P16:Before you begin reading Pure JSP Java Server Pages, you might want to take a look at its basic structure. This should help you outline your reading plan if you choose not to read the text from cover to cover. This introduction gives you an overview of what each chapter covers. | td align center String cfgTable.get new String ID td tr out.println tr td align left DESCRIPTION td td align center String cfgTable.get new String DESCRIPTION td tr out.println tr td aljgn left PRICE td td align center String cfgTable.get new String PRICE td tr System.out.println tr td aljgn left QUANTITY td td align center String cfgTable.get new String QUANTITY td tr table body html As you can see there is really very little difference in the application code and the JSP code. The only noticeable differences are the way we load the XMLResource and the way we output the results. To see this JSP run you will need to copy the SAXHandler class file to the SERVER_ROOT purejsp WEB-INF classes directory and the item.xml and the XMLExample.jsp to the SERVER_ROOT purejsp directory. Then load the following URL into your browser http yourserver 8080 purejsp XMLExample.jsp You should see a page similar to Figure 15.2. fii fdi Jcch d - - j .1 J J J J J tf Itl h tt Jrrt pt- 3 . XML 3 Im. n DESCMPTiCW PRICE 33445 AmAd Pcwsci T t Jnlrrr .h -Tkil Mm -i Myrtrry 3S.S5 Figure 15.2 Output from XMLExample.jsp. Summary In this chapter we covered the basics of XML. We covered how to use Sun s SAX parser. We also look at an example of how you would incorporate XML and JSPs. - 151 - In Chapter 16 JSP Communication with Servlets you learn how you can use JSPs and servlets using the Model-View-Controller design pattern. Chapter 16 JSP Communication with Servlets Overview In this chapter we are going to discuss how you can incorporate servlets and JSPs using the Model-ViewController design pattern MVC . The MVC originated from Smalltalk and was used to design user interfaces wherein the application was made up of three classes a Model a View and a Controller. Each of these classes is defined in Table 16.1. Table 16.1 The Classes of the MVC Class Definition Model The Model represents the data or application object. It is what is being manipulated and presented to the user. View The View is .