Download presentation
Presentation is loading. Please wait.
Published byEverett Moody Modified over 8 years ago
2
Speaker Name Speaker Title Speaker Title Oracle Corporation Olivier Le Diouris Principal Product Manager Oracle Corporation Building Servlet and JSP Applications with Oracle9i JDeveloper olivier.lediouris@oracle.com
3
Java 2 Enterprise Edition - J2EE Java Servlets and JavaServer Pages JDeveloper Servlet and JSP Features Building JSP applications Agenda
4
The J2EE Architecture
5
Oracle and J2EE
6
Java 2 Enterprise Edition - J2EE Java Servlets and JavaServer Pages JDeveloper Servlet and JSP Features Building JSP applications Agenda
7
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 …)
8
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
9
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 Multiple Roles of Java Servlets
10
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 Java Servlet Architecture
11
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 Java Servlet Architecture
12
HttpServlet doGet() { Process request from Client using Request object; Send response to client via the Response object; } Request Response Http Client Session
13
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(" "); out.println(” Hello There! "); out.println(" "); out.close(); } Java Servlets
14
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(" "); out.println(" ”); out.println(“ Bob ”); out.println(" 12345 ”); out.println(" ”); out.close(); } Java Servlets
15
LoadInitialize Handle 0 - N Client requests Destroy 1 4 23 Life Cycle of a Servlet Server Operations Client (Browser) Requests
16
Servlet Benefits Performance! Platform Independence Rich Development Environment Broad Industry Acceptance
17
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
18
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
19
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...
20
A Simple JavaServer Page example Hello! Today is: JavaServer Pages
21
A JavaServer Page using a JavaBean Employees: JavaServer Pages
22
Custom JSP Tags - 1.1 Custom Tag Libraries with JSP 1.1 Today’s Date is:
23
How is a JSP Served? Java Compiler Servlet Runner JSP Translator JSP Source Hello.jsp Generated file Hello.java Servlet class Hello http://localhost:8080/Hello.jsp Output of Hello HTML /XML JDBC JSP runtime
24
JSP Benefits Performance! Platform Independence Easy xyML Development Environment Extensible with Javabeans and Custom Tags <xml>,<html>,….
25
Java 2 Enterprise Edition - J2EE Java Servlets and JavaServer Pages JDeveloper Servlet and JSP Features Building JSP applications Agenda
26
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
27
Oracle9i JDeveloper JSP/Servlet Features Built-in OC4J runtime container –OC4J (Servlet/JSP/EJB) OC4J
28
Customizable Component Palette Oracle9i JDeveloper JSP/Servlet Features
29
JSP Insight –Tag Insight –Java Insight Oracle9i JDeveloper JSP/Servlet Features
30
Improved BC4J Data Tag Library –More useful/flexible Tags –Component Tags Oracle9i JDeveloper JSP/Servlet Features
31
JSP Code Generation Templates Oracle9i JDeveloper JSP/Servlet Features
32
J2EE WAR and EAR Deployment –Deploys to standard WAR and EAR files –One-Click Deployment to Oracle9iAS –Weblogic Deployment Support OC4J Oracle9i JDeveloper JSP/Servlet Features WAR/EAR
33
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
34
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
35
& Q U E S T I O N S A N S W E R S Q&A
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.