1 / 17

CPSC 425 Java Enterprise Application Programming

CPSC 425 Java Enterprise Application Programming. Presented by Ning Chen, Ph.D. Chair/Professor Department of Computer Science California State University, Fullerton Fall 2002 Module XML. XML [Source: Mastering Enterprise JavaBeans by Ed Roman].

zahir-horne
Télécharger la présentation

CPSC 425 Java Enterprise Application Programming

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CPSC 425 Java Enterprise Application Programming Presented by Ning Chen, Ph.D. Chair/Professor Department of Computer Science California State University, Fullerton Fall 2002 Module XML Coypright (c) Ning Chen, Ph.D. 2001

  2. XML [Source: Mastering Enterprise JavaBeans by Ed Roman] • The Extensible Markup Language (XML) is a universal standard for structuring content in electronic documents. XML is extensible, enabling business to add new structure to their documents as needed. The XML standard does not suffer the version control problems of other markup languages such as HTML, because it has no predefined tags. Rather, with XML you define your own tags for your business needs. This makes XML the ideal document format for transferring business data electronically, and it has a wide variety of other applications as well. Coypright (c) Ning Chen, Ph.D. 2001

  3. Benefits of XML [Source: Mastering Enterprise JavaBeans by Ed Roman] • XML is simple and easy to use • XML is an open, internet-standard • XML is human readable • XML has massive industry support behind it • XML has great tools available Coypright (c) Ning Chen, Ph.D. 2001

  4. XML Concept [Source: Mastering Enterprise JavaBeans by Ed Roman] • An XML document example <?xml version=“1.0”?> <library> <book isbn=“0451524934”> <title>Year 1984</title> <author>George Orwell</author> <page>268</page> <softcover/> </book> <book isbn=“036769487”> <title>The Catcher in The Rye</title> <author>J. D. Salinger</author> <page>249</page> <hardcover/> </book> </library> Coypright (c) Ning Chen, Ph.D. 2001

  5. XML Concept [Source: Mastering Enterprise JavaBeans by Ed Roman] • Prolog: <?xml version=“1.0”?> • XML Elements: <title>The Catcher in The Rye</title> • Attributes: <book isbn=“0451524934”> • The Root Element: <library> • (There are others that are not covered here.) Coypright (c) Ning Chen, Ph.D. 2001

  6. XML Parsers [Source: Mastering Enterprise JavaBeans by Ed Roman] • An XML parser is a program that reads in an XML document and verifies whether it is well formed. • A not well-formed example: <?xml version=“1.0”?> <library> <book isbn=“0451524934”> <title>Year 1984</title> <author>George Orwell</author> <page>268</page> <softcover/> Coypright (c) Ning Chen, Ph.D. 2001

  7. XML DTDs [Source: Mastering Enterprise JavaBeans by Ed Roman] • DTD – Document type definition • Valid Documents: An XML document is valid if it satisfies the structural rules laid out in its corresponding DTD. Coypright (c) Ning Chen, Ph.D. 2001

  8. XML DTDs [Source: Mastering Enterprise JavaBeans by Ed Roman] • A sample XML DTD: <?xml version=“1.0” standalone= “yes”?> <!DOCTYPE library [ <!ELEMENT library (book*)> <!ELEMENT book (title, author+, pages, description?, (hardcover | softcover))> <!ELEMENT author (#PCDATA)> <!ELEMENT title (#PCDATA)> <!ELEMENT description (#PCDATA)> <!ELEMENT hardcover EMPTY> <!ELEMENT softcover EMPTY> <!ATTLIST book isbn CDATA #REQUIRED> ]> Coypright (c) Ning Chen, Ph.D. 2001

  9. XML DTDs [Source: Mastering Enterprise JavaBeans by Ed Roman] • An XML validating parser is a program that checks that an XML document is valid according to its DTD. Coypright (c) Ning Chen, Ph.D. 2001

  10. What Is the config.xml File? [Source: edocs.bea.com] The config.xml file is an XMLdocument that describes the configuration of an entire Weblogic Server domain. The config.dtd Document Type Definition (DTD) describes the content and structure of the config.xml file. The DTD describes the valid XML tags, the tag order, whether the tags are optional, the type of data contained within the tags, the tag attributes, the attribute values, and so on. Coypright (c) Ning Chen, Ph.D. 2001

  11. Using Deployment Descriptors to Configure and Deploy Servlets [Source: edocs.bea.com] The first deployment descriptor, web.xml, is defined in the Servlet 2.2 specification from Sun Microsystems and provides a standardized format that describes the Web Application. The second deployment descriptor, weblogic.xml,isa WebLogic-specific deployment descriptor that maps resources defined in the web.xml file to resources available in WebLogic Server, defines JSP behavior, and defines HTTP session parameters. Coypright (c) Ning Chen, Ph.D. 2001

  12. web.xml (Web Application Deployment Descriptor) In the Web Application deployment descriptor you define the following attributes for HTTP servlets: Servlet name Java class of the servlet servlet initialization parameters Whether or not the init() method of the servlet is executed when WebLogic Server starts URL pattern which, if matched, will call this servlet Security MIME type Error pages References to EJBs References to other resources Coypright (c) Ning Chen, Ph.D. 2001

  13. Directory Structure[Source: edocs.bea.com] Coypright (c) Ning Chen, Ph.D. 2001

  14. WEB.XML Location Coypright (c) Ning Chen, Ph.D. 2001

  15. WEB.XML Build Location Coypright (c) Ning Chen, Ph.D. 2001

  16. WEB.XML <servlet> <servlet-name>HelloWorldServlet</servlet-name> <servlet-class>examples.servlets.HelloWorldServlet</servlet-class> </servlet> <servlet> <servlet-name>HTTPPostServlet</servlet-name> <servlet-class>examples.servlets.HTTPPostServlet</servlet-class> </servlet> Coypright (c) Ning Chen, Ph.D. 2001

  17. WEB.XML <servlet-mapping> <servlet-name>HelloWorldServlet</servlet-name> <url-pattern>/HelloWorldServlet/*</url-pattern> </servlet-mapping> <servlet-mapping> <servlet-name>HTTPPostServlet</servlet-name> <url-pattern>/HTTPPostServlet/*</url-pattern> </servlet-mapping> Coypright (c) Ning Chen, Ph.D. 2001

More Related