Oracle JDeveloper 10g Overview - PowerPoint PPT Presentation

1 / 31
About This Presentation
Title:

Oracle JDeveloper 10g Overview

Description:

... Form) bundled into Javabean for reuse and perform validation ... creates/reuses any associated form bean. creates. looks up path to determine action/ form bean ... – PowerPoint PPT presentation

Number of Views:60
Avg rating:3.0/5.0
Slides: 32
Provided by: shayshm
Category:

less

Transcript and Presenter's Notes

Title: Oracle JDeveloper 10g Overview


1
(No Transcript)
2
Web Development with
Karsten Schulz Terp-Nielsen Master Principal
Sales Consultant Oracle Denmark
3
Agenda
  • JDeveloper 10g overview
  • Application Developer Framework (ADF)
  • Web Development with Struts

4
Full Lifecycle Support
Design

DataModeling
Application Modeling
Infrastructure
IDE Platform
Build

Coding
Test

Debugging
Tuning
Configuration Management
Deploy

Deployment
5
JDeveloper Framework Support
  • J2EE Frameworks
  • Application Development Framework (ADF)
  • Apache Struts support
  • ADF Business Components
  • Oracle 9i/AS10g Toplink
  • UiX
  • Java Server Faces (JSF)

6
Oracle ADFEnd-to-end J2EE Framework
  • Implements standard J2EE best practices
  • Model-View-Controller (MVC) design pattern
  • Focus on the application, not the plumbing
  • Consolidation and evolution of previous frameworks

Web and Wireless Clients
Rich Clients
Controller
Model
Business Services
7
ADF Productivity With Choice
Rich Client
Web / Wireless
View
Swing / JClient
JSP
ADF UIX
JSF
Controller
Struts
ADF Bindings
Model
ADF Data Control
BusinessServices
JavaClasses
EJBSessionBeans
WebServices
ADF Metadata Services
JDBC
TopLinkQueries
EJBFinders
DataAccess
PersistentBusinessObjects
Java Classes
EJB Entity Beans
TopLink Mapping
8
StrutsModel 1 Architecture
  • Browser access JSP pages JSPs access JavaBeans
    that represent model
  • Control de-centralized current page display,
    determined next page to display
  • Complex navigation requires use of scriplet code
  • Blurs the line between presentation and
    navigation code and making reuse difficult
  • Not a model to use in practice - maintenance
    difficult and does not scale well

9
StrutsModel 1 Architecture
Model 1
Decentralized controller - in each JSP page
10
StrutsModel 1 Architecture
No MVC - Statically Linked Pages
Servlet/JSP
Servlet/JSP
Servlet/JSP
Servlet/JSP
Web Server
11
StrutsModel-View-Controller Model 2
  • Introduces a controller servlet
  • Controller Servlet handle the data access and
    navigational flow
  • JSPs handle presentation
  • Controller centralizes the logic for dispatching
    requests to the next view based on the request
    URL, input parameters, and application state
  • Controller also handles view selection, which
    decouples JSP pages and servlets from one another

12
StrutsModel-View-Controller Model 2
Controller
HTTP
State Change
JavaBean
Request
Servlet
View Selection
User Actions
JDBC
Database
HTTP
Enterprise
Response
State Query
JavaBean
JSP
Change Notification
View
Model
13
StrutsModel-View-Controller Model 2
Applying MVC to a Page Flow
Web Server
Servlet/JSP Controller
14
StrutsWhat is It ?
  • Open source Apache Jakarta Project
  • An implementation of MVC paradigm
  • A framework written in Java, to build web tier
    employing servlets, JSPs and XML
  • De facto standard for J2EE MVC applications
  • Bundled with JDeveloper and works on OC4J

15
StrutsComponents
  • ActionServlet class Part of controller that
    receives user input and state changes and issues
    view selections
  • Action class Part of controller that interacts
    with model to execute a state change or query
  • ActionForm Beans Data (from Form) bundled into
    Javabean for reuse and perform validation
  • ActionForward class stores path to a page where
    the user is sent to
  • ActionMapping holds mapping that tells
    controller which Actions, ActionForms,
    ActionsForwards to use

16
StrutsComponents (2)
  • Struts-config.xml Glue of the framework - holds
    declarations of the earlier listed components and
    other details. ActionServlets reads this file
    and create the configuration objects in memory
  • Strut Tag Libraries Custom tags that simplify
    working with Struts aiding the view component and
    access Model thru Java Beans
  • Property files store messages and handle
    different languages

17
StrutsStruts Pictorially
Web Browser
Jsp 1
Jsp 3
Jsp 2
Page 1
View Layer
request/session
App Server
JSP Engine
Form Bean 1
Form Bean 2
Other Bean 1
Controller
Struts- config. xml
Mappings
Action2 .java
Action3 .java
Action4 .java
Action1 .java
  • path
  • action
  • form bean
  • forwards

Business Logic Layer
Business Bean 1
Business Bean 2
Business Bean 3
JDBC
Data Layer
Database
18
StrutsActionForm
  • Holds state and behavior for user input
  • ActionForms are JavaBeans with reset() and
    validate() methods for user input
  • ActionForm extends org.apache.struts.action.Action
    Form
  • Typically one ActionForm bean created for each
    HTML form
  • ActionForm has corresponding property for each
    field on HTML form

19
StrutsActionForm Example
public final class FAQForm extends ActionForm
private String question private String
answer .. public String getQuestion()
return question public void
setQuestion(String question) this.question
question .. public ActionErrors
validate(ActionMapping mapping,
HttpServletRequest request)
ActionErrors errors new ActionErrors() if
((getQuestion() null) (getQuestion().length(
) lt 1)) errors.add("question",
new ActionError("errors.question.required
")) .. return errors
lt!-- Logon form bean definition in
struts-config.xml  --gt ltform-bean
name"FAQForm" type"faqapp.web.struts.forms.FAQFo
rm" /gt
20
StrutsAction
  • Action class receives the ActionForm(which holds
    the data) and you perform action/processing here
  • Action provides a loose coupling between Web tier
    and business tier
  • Controller decides which Action class, using the
    mapping info
  • Action is invoked by calling perform() method

21
StrutsAction - Example
public final class FAQQueryAction extends Action
public ActionForward perform(ActionMapping
mapping, ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws
IOException, ServletException String
result null ... try
result FAQHelper.getFAQHelper().query(actionForm
, request) request.setAttribute("action"
, Constants.QUERY) ...
return mapping.findForward(result)
22
StrutsActionMapping
  • ActionMapping object maps the Actions to URI, or
    path
  • Specified in struts-config.xml

ltaction-mappingsgt ltaction
path"/faqQuery" type"faqapp.web.struts.a
ctions.FAQQueryAction"
name"FAQQueryForm" scope"request"
validate"true" input"/faqQuery.do"gt lt/acti
on-mappingsgt
23
StrutsActionForward
  • Encapsulates the destination of where to send
    control upon completion of the Action
  • The destination(JSP, HTML file , servlet) is
    detailed in the configuration file
    struts-config.xml
  • Objects that have logical name for referring and
    a path property

lt! -- Forward Definition in struts-config.xml  
--gt ltforward name"success"
path"/WEB-INF/FAQQuery.jsp"/gt
24
StrutsActionServlet
  • Primary task is to route request URI to an Action
    class using the configuration information(struts-c
    onfig.xml)
  • Is the director - working behind the scene,
    administering the behavior of controller
  • Configured using web.xml of the application and
    mapped to receive url patterns such as .do
  • Only one ActionServlet can be loaded for an
    application
  • Used as a black box in most cases, though it can
    be extended

25
Strutsstruts-config.xml
  • Holds declarations of Struts components that
    define the configuration
  • Living blueprint of your application
  • What fields are on the forms
  • Where JSPs are found
  • Knows about every action and the resources needed
  • Power and flexibility of Struts is due to
    extracting out configuration information, across
    the frame work into struts-config.xml

26
Strutsstruts-config.xml - Example
lt?xml version"1.0" encoding"ISO-8859-1"
?gt lt!DOCTYPE struts-config PUBLIC "-//Apache
Software Foundation//DTD Struts Configuration
1.0//EN "http//jakarta.apache.org/struts/dtds/s
truts-config_1_0.dtd"gt ltstruts-configgt lt!--
Form Bean Definitions
  --gt lt!-- FAQForm
form bean   --gt   ltform-bean name"FAQForm"
type"faqapp.web.struts.forms.FAQForm/gt  
ltform-bean name"FAQQueryForm
type"faqapp.web.struts.forms.FAQQueryForm" /gt
lt!-- Global Forward Definitions
  --gt ltglobal-forwards
type"org.apache.struts.action.ActionForward"gt 
ltforward name"error" path /WEB-INF/Error.jsp"
/gt   ltforward name"warning" path
/WEB-INF/Warning.jsp" /gt  
lt/global-forwardsgt lt!-- Action
Mapping Definitions   --gt
ltaction-mappingsgt ltaction path"/faqQuery"
type"faqapp.web.struts.actions.FAQQueryAction"
name"FAQQueryForm" scope"request"
validate"true" input"/faqQuery.do"gt lt/action-map
pingsgt  lt/struts-configgt
27
StrutsA Look into web.xml
ltservletgt  ltservlet-namegtactionlt/servlet-namegt
  ltservlet-classgtorg.apache.struts.action.Actio
nServletlt/servlet-classgt ltinit-paramgt 
ltparam-namegtapplicationlt/param-namegt  
ltparam- valuegtApplicationResourceslt/param-valuegt
  lt/init-paramgt ltinit-paramgt 
ltparam-namegtconfiglt/param-namegt  
ltparam-valuegt/WEB-INF/struts-config.xmllt/param-val
uegt lt/init-paramgt ltinit-paramgt 
ltparam-namegtdebuglt/param-namegt  
ltparam-valuegt2lt/param-valuegt   lt/init-paramgt
ltinit-paramgt  ltparam-namegtdetaillt/param-nam
egt   ltparam-valuegt2lt/param-valuegt  
lt/init-paramgt lt/servletgt
28
How it all Works
Jsp 1
Jsp 2
Jsp 3
Jsp 2
Jsp 2
Page 1
pure HTML sent to browser
Web Browser
processes custom tags fill form elements from
beans, display internationalized messages
Application Server
request/session
View Layer
incoming requests
Form Bean 1
Jsp Engine
Form Bean 2
relevant page called
if submit, auto populates form bean from request
params

creates/reuses any associated form bean






reads on start-up
Controller
Struts- config. xml
looks up path to determine action/ form bean
creates
passes control to relevant action to handle
returns appropriate forward
Mappings
Action2 .java
Action3 .java
Action1 .java
  • path
  • action
  • form bean
  • forwards

interacts with lower layers - acts as adaptor
between HTTP and layers below
gets data to display (adds to beans in
request/session)or saves data from beans via
business rules
Business Logic Layer
Business Bean 1
Business Bean 2
Business Bean 3
Data Layer
Business Data
29
StrutsJSP Tag Libraries
  • HTML JSP custom tags
  • bridge between a JSP view and the other
    components of a Web application
  • Tags relating to HTML forms, message and error
    handling, maintaining hyperlinks and
    internalization
  • Bean JSP custom tags
  • Tags useful for accessing beans, their
    properties,and defining beans based on access
  • Create new beans based on the value of request
    cookies, headers, and parameters in any scope
  • Logic tags
  • Tags for conditional generation of output text,
    looping, comparison/sub-string matching

30
StrutsUsing Struts JSP tags
lt_at_ taglib uri"/tags/struts-bean" prefix"bean"
gt lt_at_ taglib uri"/tags/struts-html"
prefix"html" gt lt_at_ taglib uri"/tags/struts-logi
c" prefix"logic" gt ltHTMLgt ltHEADgt ltTITLEgtWelcome!
lt/TITLEgt lthtmlbase/gt lt/HEADgt ltBODYgt ltlogicpresen
t name"user"gt ltH3gtWelcome ltbeanwrite
name"user" property"username"/gt!lt/H3gt lt/logicpr
esentgt ltlogicnotPresent scope"session"
name"user"gt ltH3gtWelcome World!lt/H3gt lt/logicnotPr
esentgt lthtmlerrors/gt ltULgt ltLIgtlthtmllink
forward"logon"gtSign inlt/htmllinkgtlt/LIgt ltlogicpr
esent name"user"gt ltLIgtlthtmllink
forward"logoff"gtSign outlt/htmllinkgtlt/LIgt lt/logic
presentgt lt/ULgt ltIMG src'struts-power.gif'
alt'Powered by Struts'gt lt/BODYgt lt/HTMLgt
31
Demonstration
  • Develop a Web Application based on Struts and
    EJBs as the model
Write a Comment
User Comments (0)
About PowerShow.com