JDeveloper 10 g and Java Server Faces HighPerformance
- Slides: 42
JDeveloper 10 g and Java. Server Faces: High-Performance UIs on the Web Avrom Roy-Faderman Senior Programmer May, 2006
Agenda • A Brief History of Java Web Apps • Java. Server Faces • ADF Faces • Q&A
A Brief History of Java Web Apps • Productivity and Maintainability • Capabilities and Performance
Servlets • Java classes executed on the server in response to HTTP requests • Originally used to output HTML · This use required extensive and awkward Java coding
JSP Model 1 • Files closely resembling HTML except for: · Some specialized tags · “Scriptlets” – embedded bits of Java code • Compiled into Servlets · HTML portions outputted directly into generated HTML · Specialized tags run bits of Java · Scriptlets run directly
Problems with JSP Model 1 • Hard to Change Page Flow • Mix of Java (sometimes extensive Java) and Tags on Same Page
Model 2 Architectures • Separate out “View” and “Controller” · View renders UI · Controller handles page flow and responds to user requests • No hardcoded links in view • Generally no procedural code in view
A Brief History of Java Web Apps • Productivity and Maintainability • Capabilities and Performance
“Thick Client” vs. Web: The Past · Requires customized client · Large downloads · High-interactivity · High-performance · Runs in unmodified web browser · Small downloads · Low-interactivity · Low-performance Server
“Web 2. 0” • Still run in unmodified browser • Relatively small download size • Much more interactive than traditional web apps • Much higher-performance than traditional web apps
Agenda • A Brief History of Java Web Apps • Java. Server Faces • ADF Faces • Q&A
Java. Server Faces • The J 2 EE standard Model 2 Web Applicaton Architecture • Special tag libraries for JSPs/JSPX documents · Html · Core • Separate controller
Java. Server Faces • JSF JSP and Components • Page Flow • Managed Beans
Simple JSF JSP Code <body> <h: form> <h: select. One. Menu id="color" required="true"> <f: select. Item item. Label="Red" item. Value="red" /> <f: select. Item item. Label="Green" item. Value="green" /> </h: select. One. Menu> </h: form> </body>
JSF JSP/JSPX and the Component Palette
Java. Server Faces • JSF JSP and Components • Page Flow • Managed Beans
The JSF Controller: Page Flow • All page flow information mainained in faces-config. xml • JDeveloper has graphical representations of page flow
JSF Page Flow and the Component Palette
JSF Navigation Cases • Navigation cases referenced in JSF JSP/JSPX pages • Converted into destination by controller <h: command. Link action="go. Home"> Go home! </h: command. Link>
Java. Server Faces • JSF JSP and Components • Page Flow • Managed Beans
Managed Beans • The JSF Controller can be configured to automatically create and manage Java objects • Controller or view can access “managed properties” on these objects • Scoping: · Application · Session · Request
Accessing Managed Properties: JSP • “JSP Expression Language” · Syntax: #{bean. Name. property. Name} · Can even have nested properties: #{bean. Name. property 1. property 2} • Use these expressions as attributes for tags <h: output. Text value="#{home. Bean. main. Label} />
Managed Bean Classes • Each managed bean has a class that you can edit · Constructor runs at the beginning of the application/request/session · Methods that allow you to access managed properties • Put complex logic in here instead of putting it in the view
Managed Bean Example <h: output. Text value="#{home. Bean. main. Label} /> public class Navigation. Bean { public Navigation. Bean() { if /* some condition */ { set. Main. Label("Red"); } else { set. Main. Label("Green"); } } /* … */ }
Conditional Page Flow • Instead of referring to a JSF navigation case, refer to a function that *returns* one. <h: command. Link action="#{home. Bean. next. Action}"> Go on! </h: command. Link> public String next. Action() { if /* some condition */ { return("go. Status"); } else { return("go. Order"); } }
Agenda • A Brief History of Java Web Apps • Java. Server Faces • ADF Faces • Q&A
ADF Faces • Oracle ADF • The ADF Binding Filter • Partial Page Refresh
ADF and MVC • Oracle ADF is a framework based on MVC architecture View and Controller (Desktop Clients) View (Web and Wireless Clients) Controller (Web and Wireless Clients) Model Business Services
ADF and MVC • Oracle ADF is a framework based on MVC architecture ADF Swing ADF Faces Components ADF Binding Filter ADF Data Bindings ADF Business Components
ADF Faces • Oracle ADF • The ADF Binding Filter • Partial Page Refresh
ADF Binding Filter • Runs with each HTTP request • Sets up a Struts managed bean, “bindings”, containing all ADF data bindings <af: input. Text value="#{bindings. Emp. Name. input. Value} /> ADF Data Bindings Database Business Service
The Data Control Palette
ADF Faces • Oracle ADF • The ADF Binding Filter • Partial Page Refresh
Traditional “Web 1. 0 Cycle” Request submitted to server Server renders page Page downloaded to user User clicks button or link User fills out form
Component Trees • You can think of a JSP/JSPX document as being a tree of components <afh: body> <af: form> <af: select. One. Menu id="color" required="true"> <af: select. Item item. Label="Red" item. Value="red" /> <af: select. Item item. Label="Green" item. Value="green" /> </af: select. One. Menu> </af: form> </afh: body>
Partial Page Refresh • Use Javascript to submit a form at times other than when a user presses a button or link • On server, re-render only a portion of component tree • Download only the appropriate fragment of HTML
Partial Page Refresh—How It Works Server
Web Cycle with PPR Request submitted to server Server renders components User manipulates component Components downloaded to user
ADF Faces and PPR • Many components always use PPR · · Table sorting Table pagination Expandable tables and menus … • Almost all components can use PPR · Requires some manual work
Simple PPR Example <af: input. Text id="my. Text. Field" auto. Submit="true" partial. Submit="true" />. . . <af: output. Text id="my. Text. Output" value="#{home. Bean. calculated. Val}" partial. Triggers="my. Text. Field" />
A Few Words about AJAX Asynchronous Javascript And XML • PPR is an important part of “Web 2. 0” · But PPR, by itself, isn’t truly asynchronous · ADF Faces (and regular JSF) “supports” full AJAX, but really only in that it supports Javascript
Q&A
- Six faces twelve edges and eight vertices
- Jsf lifecycle
- Java server pages tutorial
- Irc java
- Java irc
- Java client server tutorial
- Java.rmi.server.codebase
- Lập trình socket giao tiếp tcp client/server java
- Knock knock server java
- Jsf sample
- Java server pages
- Java server pages
- Java server pages
- Java number
- Java import java.util.*
- Import java.applet.applet
- Java import scanner
- Java
- Import java.util.scanner;
- Java.util.random
- Java import java.io.*
- Import java.util.
- Java thread import
- Perbedaan antara java swing dan awt adalah
- Import java.awt.* import java.awt.event.*
- Java interpreter
- Rmi vs ejb
- Pyramid faces edges vertices
- 3d shapes edges vertices and faces
- Painted faces and long hair meaning
- Different faces different places song
- Fonts and faces in multimedia
- Places and faces of the ffa
- Ffa back in the day
- Faces and voices of recovery uk
- A rectangular prism has how many flat surfaces
- How many vertex does a cone have
- Polyhedron shapes
- Smiling faces beautiful places
- Mask of many faces
- Soccss
- South dakota great faces great places
- Prisma solido