1 / 35

Speaker Name Speaker Title Speaker Title Oracle Corporation

Building Servlet and JSP Applications with Oracle9i JDeveloper. Speaker Name Speaker Title Speaker Title Oracle Corporation. Olivier Le Diouris Principal Product Manager Oracle Corporation. olivier.lediouris@oracle.com. Agenda. Java 2 Enterprise Edition - J2EE

tfeliciano
Download Presentation

Speaker Name Speaker Title Speaker Title Oracle Corporation

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. Building Servlet and JSP Applications with Oracle9i JDeveloper Speaker NameSpeaker Title Speaker Title Oracle Corporation Olivier Le Diouris Principal Product Manager Oracle Corporation olivier.lediouris@oracle.com

  2. Agenda • Java 2 Enterprise Edition - J2EE • Java Servlets and JavaServer Pages • JDeveloper Servlet and JSP Features • Building JSP applications

  3. The J2EE Architecture

  4. Oracle and J2EE

  5. Agenda • Java 2 Enterprise Edition - J2EE • Java Servlets and JavaServer Pages • JDeveloper Servlet and JSP Features • Building JSP applications

  6. Java Servlets • What Are Servlets? • Servlets are platform-independent, server-side Java components which extend an HTTP server • Like mini-webservers • HttpServlet - Dynamic Page generation (HTML, XML, …) • Superior to inefficient CGI and proprietary APIs (ISAPI, NSAPI …)

  7. Java Servlets • What Are Servlets? • Portable to any Application Server with Java Virtual Machine • Servlets have access to the entire family of Java APIs • JDBC • EJB • JavaMail ... • Widespread industry acceptance

  8. Multiple Roles of Java Servlets Java Servlets provide many useful services • Provides low-level API for building Internet Services • Serves as foundation to JavaServer Pages • Can deliver multiple types of data to any client • XML, HTML, WML, GIF, etc... • Can serve as “Controller” of JSP/Servlet application

  9. Java Servlet Architecture The ServletRequest Object • Encapsulates all request information from the client • request headers • form data and query parameters • other client data{session info, cookies, path ...etc.} The ServletResponse Object • Encapsulates all data sent back to client • response headers • OutputStream to write data to the client • setting cookies

  10. Java Servlet Architecture The HttpSession Object • Allows for the storage of transient, session data • Easy way to identify a single user between page requests • Servlets can obtain data from session, modify and store it again • Typical Example - Online Store • Customer profile information • Shopping Cart

  11. Java Servlet Architecture Http Client HttpServlet doGet() { Process request from Client using Request object; Send response to client via the Response object; } Request Response Session

  12. Java Servlets A Hello HttpServlet example public class HelloServlet extends HttpServlet { public void doGet(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException { PrintWriter out =response.getWriter(); out.setContentType(“text/html”); out.println("<html><body>"); out.println(”<h1>Hello There!</h1>"); out.println("</body></html>"); out.close(); }

  13. Java Servlets A Servlet which sends XML data public class FormServlet extends HttpServlet { public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { PrintWriter out = response.getWriter(); out.setContentType(“text/xml”); out.println("<?xml version=\"1.0\"?>"); out.println("<Employee>”); out.println(“<Name>Bob</Name>”); out.println("<Empno>12345</Empno>”); out.println("</Employee>”); out.close(); }

  14. Life Cycle of a Servlet 1 2 3 Server Operations Client (Browser) Requests Handle 0 - N Client requests Load Initialize Destroy 4

  15. Servlet Benefits • Performance! • Platform Independence • Rich Development Environment • Broad Industry Acceptance

  16. JavaServer Pages • What is a JavaServer Page? • JavaServer Pages separate content presentation from content generation. • Provides a simple and fast way to build dynamic page content (HTML, XML, etc) • xyML with embedded Java code • Extensible with components & custom tags

  17. JavaServer Pages & Servlets • JavaServer Pages are based on Servlet technology • JSP container is a Servlet • Each JSP is compiled into runtime Servlet • Same performance and portability benefits from Servlet technology but with the ease of use of markup language • Best of both worlds for web designers and web developers

  18. JavaServer Pages • JavaServer Pages consist of HTML pages with special tags which allow for inclusion of Java logic • Scriptlets <% … %> • Directives <%@ ... %> • Expressions <%= … %> • Declarations <%! … %> • Other Tags - UseBean, setProperty...

  19. JavaServer Pages A Simple JavaServer Page example <HTML> <BODY> <P>Hello! <BR> Today is:<%= new java.util.Date() %> </BODY> </HTML>

  20. JavaServer Pages A JavaServer Page using a JavaBean <HTML> <BODY> <jsp:useBean class=“beans.nameBean” id=“namebean” scope=“page”> Employees: <%=nameBean.showEmps() %> </BODY> </HTML>

  21. Custom JSP Tags - 1.1 Custom Tag Libraries with JSP 1.1 <HTML> <BODY> <%@ taglib uri=“/myowntags.tld” prefix=“mytags” %> <P> Today’s Date is: <mytags:ShowDate format=“mm/dd/yy”> </BODY> </HTML>

  22. How is a JSP Served? http://localhost:8080/Hello.jsp Java JSP Servlet Compiler Translator Runner JDBC Outputof Hello HTML /XML JSP SourceHello.jsp Generated file Hello.java Servlet class Hello JSP runtime

  23. JSP Benefits • Performance! • Platform Independence • Easy xyML Development Environment • Extensible with Javabeans and Custom Tags <xml>, <html>, ….

  24. Agenda • Java 2 Enterprise Edition - J2EE • Java Servlets and JavaServer Pages • JDeveloper Servlet and JSP Features • Building JSP applications

  25. Existing JDeveloper JSP/Servlet Features • HttpServlet Wizard • JSP Wizard • Integrated JSP/Servlet runtime • BC4J Data Tag Library • Code generation with Datapage wizard • Local and Remote Debugging

  26. Oracle9i JDeveloper JSP/Servlet Features • Built-in OC4J runtime container • OC4J (Servlet/JSP/EJB) OC4J

  27. Oracle9i JDeveloper JSP/Servlet Features • Customizable Component Palette

  28. Oracle9i JDeveloper JSP/Servlet Features • JSP Insight • Tag Insight • Java Insight

  29. Oracle9i JDeveloper JSP/Servlet Features • Improved BC4J Data Tag Library • More useful/flexible Tags • Component Tags

  30. Oracle9i JDeveloper JSP/Servlet Features • JSP Code Generation Templates

  31. Oracle9i JDeveloper JSP/Servlet Features • J2EE WAR and EAR Deployment • Deploys to standard WAR and EAR files • One-Click Deployment to Oracle9iAS • Weblogic Deployment Support WAR/EAR OC4J

  32. Demonstration JSP & Servlet Development in Oracle9i JDeveloper This demonstration shows you how to: • Build and debug simple servlets and JSPs • Use custom JSP tag libraries • Customize Component Palette • Build BC4J based JSP applications • Deploy a BC4J JSP application to Oracle9iAS

  33. Summary In this Presentation you have learned: • Servlet and JSP Basics • How to build and debug Servlets and JSPs with Oracle9i JDeveloper • How create BC4J JSP applications and deploy them to Oracle9iAS

More Related