SlideShare uma empresa Scribd logo
1 de 29
JavaEE 6 Pet Catalog Carol McDonald Java Architect
About the Speaker ,[object Object]
Before Sun, worked on software development of:  ,[object Object]
Pharmaceutical  Intranet apps  ( Roche  Switzerland)
Telecom  Network Mgmt  ( Digital  France)
X.400  Email Server  ( IBM  Germany)
Sample Application
Catalog Java EE  Application DB Registration Application Managed Bean JSF Components Session Bean Entity Class Catalog Item ManagedBean
Simple Mapping Mapping defaults  to matching  column name . Only  configure   if  entity field and table column names are  different   public class Item {    int id;   String name;    String description;   String   url ; } @Entity @Column(name=“DECS”) @Id Item ID NAME DESC URL
Catalog Java EE  Application DB Registration Application Managed Bean JSF Components Session Bean Entity Class Catalog Item ManagedBean
Stateless Session EJB, JPA Query  @Stateless public class  ItemDAO @PersistenceContext(unitName=”PetCatalogPu”)   EntityManager em; public List<Item>  findRange (int  firstItem , int  batchSize ) {  Query  q =  em . createQuery (&quot; select i from Item as i &quot;);  q. setMaxResults ( batchSize ); q. setFirstResult ( firstItem ); return q.getResultList();  } }
JSF  Component, Event  Driven  Web Framework Pages composed of  server side   components View Root Form id=guess Managed Bean getUserNumber() setUserNumber(..) guess() Business Service guess() Events  call ManagedBean methods UIIput  id=guessNum UICommand  id=submit
What is a JSF UI Component? Some Standard Components
JSF Web Framework  View Controller Model Request Service  Interface Events
Catalog Java EE  Application DB Registration Application Managed Bean JSF Components Session Bean Entity Class Catalog Item ManagedBean
List Items  page  Data Table
list.xhtml  Page < h:dataTable  var=&quot; row &quot; value=&quot;#{ catalog.items }&quot;> <h:column> … < h:commandLink  action=&quot;#{ catalog.showDetail ( row )}&quot;  value=&quot;#{ row.name }&quot; /> <h:column> ... < h:graphicImage   name=&quot;#{ row.imagethumburl }&quot; /> … <h:column> < h:outputTex t  value =&quot;#{ row.price }&quot;/> ... </h:dataTable>
Binding UI to Managed Bean list.xhtml <h: dataTable value =&quot;#{ catalog .items }&quot; @ManagedBean   (name = &quot;Catalog&quot;) @SessionScoped public class  Catalog  { }
Managed Bean Value Binding ,[object Object],[object Object],<h: dataTable  value =&quot;#{catalog .items }&quot;/> ,[object Object],<h: input Text   value =&quot;#{ user .name }&quot;/> GET SET
list.xhtml  Page < h:dataTable  var=&quot; row &quot; value=&quot;#{ catalog.items }&quot;> <h:column> … < h:commandLink  action=&quot;#{ catalog.showDetail ( row )}&quot;  value=&quot;#{ row.name }&quot; /> <h:column> ... < h:graphicImage   name=&quot;#{ row.imagethumburl }&quot; /> … <h:column> < h:outputTex t  value =&quot;#{ row.price }&quot;/> ... </h:dataTable>
UIComponents   Binding  to a Managed Bean public class  Catalog { private List<Item> items = null; public List<Item>  getItems()  { . . . return items; }  . . . } <h: dataTable   value =&quot;#{ catalog .items }&quot; Managed Bean property Managed Bean dataTable   useful to show a  Collection  in a  table Client Server A B C Backing Bean Form c1 A c2 B c3 C c1 c2 c3 A B C Page
Managed Bean: ItemController public class ItemController { private List<Item> items = null; @EJB  private ItemDAO  itemDAO ; public  List<Item>   getItems()  {  getPagingInfo(); return itemDAO.findRange(pagingInfo.getBatchSize(), pagingInfo.getFirstItem()); } . . .
Relationship Between Objects findRange() via  EntityBean #{catalog.items} Item Entity ItemDAO Catalog list.xhtml
List Items  page  Link to see Item Details
list.jsp <h:dataTable var=&quot;row&quot; value=&quot;#{catalog.items}&quot;  > <h:column> <f:facet name=&quot;header&quot;> <h:outputText value=&quot;#{msgs.Name}&quot;/> </f:facet> <h :commandLink  action = &quot;#{catalog.showDetail(row)}&quot;  value=&quot;#{row.name}&quot; /> </h:column> <h:column> <f:facet name=&quot;header&quot;> <h:outputText value=&quot;#{msgs.Photo}&quot;/> </f:facet> <h:graphicImage library=&quot;images&quot; name=&quot;#{row.imagethumburl}&quot;/> </h:column> <h:column> <f:facet name=&quot;header&quot;> <h:outputText value=&quot;#{msgs.Price}&quot;/> </f:facet> <h:outputText value=&quot;#{row.price}&quot; /> </h:column> </h:dataTable> Click causes Action Event
JSF controller handles   action events,   such as submitting a form or linking to another page. JSF Standard request processing lifecycle Request Restore View Response Render Response Apply Request Values Invoke Application Update Model Values Process Validations action events
Invoke Application Phase ,[object Object],[object Object],[object Object]
public String  showDetail (Item  item ) {
this.item = item;

Mais conteúdo relacionado

Mais procurados

Mastering Oracle ADF Bindings
Mastering Oracle ADF BindingsMastering Oracle ADF Bindings
Mastering Oracle ADF BindingsEuegene Fedorenko
 
Best practices on how to import data into OpenERP. Cyril Morisse, Audaxis
Best practices on how to import data into OpenERP. Cyril Morisse, AudaxisBest practices on how to import data into OpenERP. Cyril Morisse, Audaxis
Best practices on how to import data into OpenERP. Cyril Morisse, AudaxisOdoo
 
카카오커머스를 지탱하는 Angular
카카오커머스를 지탱하는 Angular카카오커머스를 지탱하는 Angular
카카오커머스를 지탱하는 Angularif kakao
 
Joel Landis Net Portfolio
Joel Landis Net PortfolioJoel Landis Net Portfolio
Joel Landis Net Portfoliojlshare
 
New Form Element in HTML5
New Form Element in HTML5New Form Element in HTML5
New Form Element in HTML5Zahra Rezwana
 
Entity Attribute Value (Eav)
Entity   Attribute   Value (Eav)Entity   Attribute   Value (Eav)
Entity Attribute Value (Eav)Tâm
 
AngularJs Workshop SDP December 28th 2014
AngularJs Workshop SDP December 28th 2014AngularJs Workshop SDP December 28th 2014
AngularJs Workshop SDP December 28th 2014Ran Wahle
 
Agile data presentation 3 - cambridge
Agile data   presentation 3 - cambridgeAgile data   presentation 3 - cambridge
Agile data presentation 3 - cambridgeRomans Malinovskis
 
angularJs Workshop
angularJs WorkshopangularJs Workshop
angularJs WorkshopRan Wahle
 
Asp.net mvc training
Asp.net mvc trainingAsp.net mvc training
Asp.net mvc trainingicubesystem
 
EAV Sytem- Magento EAV Model
EAV Sytem- Magento EAV ModelEAV Sytem- Magento EAV Model
EAV Sytem- Magento EAV ModelKhoa Truong Dinh
 
Implementation of EAV pattern for ActiveRecord models
Implementation of EAV pattern for ActiveRecord modelsImplementation of EAV pattern for ActiveRecord models
Implementation of EAV pattern for ActiveRecord modelsKostyantyn Stepanyuk
 
Oleksandr Masovets. Forms in Drupal. Drupal Camp Kyiv 2011
Oleksandr Masovets. Forms in Drupal. Drupal Camp Kyiv 2011Oleksandr Masovets. Forms in Drupal. Drupal Camp Kyiv 2011
Oleksandr Masovets. Forms in Drupal. Drupal Camp Kyiv 2011Vlad Savitsky
 
Why SOLID matters - even for JavaScript
Why SOLID matters - even for JavaScriptWhy SOLID matters - even for JavaScript
Why SOLID matters - even for JavaScriptmartinlippert
 
No internet? No Problem!
No internet? No Problem!No internet? No Problem!
No internet? No Problem!Annyce Davis
 
Summer - The HTML5 Library for Java and Scala
Summer - The HTML5 Library for Java and ScalaSummer - The HTML5 Library for Java and Scala
Summer - The HTML5 Library for Java and Scalarostislav
 

Mais procurados (20)

Mastering Oracle ADF Bindings
Mastering Oracle ADF BindingsMastering Oracle ADF Bindings
Mastering Oracle ADF Bindings
 
Rails <form> Chronicle
Rails <form> ChronicleRails <form> Chronicle
Rails <form> Chronicle
 
ajax_pdf
ajax_pdfajax_pdf
ajax_pdf
 
Best practices on how to import data into OpenERP. Cyril Morisse, Audaxis
Best practices on how to import data into OpenERP. Cyril Morisse, AudaxisBest practices on how to import data into OpenERP. Cyril Morisse, Audaxis
Best practices on how to import data into OpenERP. Cyril Morisse, Audaxis
 
카카오커머스를 지탱하는 Angular
카카오커머스를 지탱하는 Angular카카오커머스를 지탱하는 Angular
카카오커머스를 지탱하는 Angular
 
Joel Landis Net Portfolio
Joel Landis Net PortfolioJoel Landis Net Portfolio
Joel Landis Net Portfolio
 
New Form Element in HTML5
New Form Element in HTML5New Form Element in HTML5
New Form Element in HTML5
 
Entity Attribute Value (Eav)
Entity   Attribute   Value (Eav)Entity   Attribute   Value (Eav)
Entity Attribute Value (Eav)
 
AngularJs Workshop SDP December 28th 2014
AngularJs Workshop SDP December 28th 2014AngularJs Workshop SDP December 28th 2014
AngularJs Workshop SDP December 28th 2014
 
Agile data presentation 3 - cambridge
Agile data   presentation 3 - cambridgeAgile data   presentation 3 - cambridge
Agile data presentation 3 - cambridge
 
angularJs Workshop
angularJs WorkshopangularJs Workshop
angularJs Workshop
 
Asp.net mvc training
Asp.net mvc trainingAsp.net mvc training
Asp.net mvc training
 
EAV Sytem- Magento EAV Model
EAV Sytem- Magento EAV ModelEAV Sytem- Magento EAV Model
EAV Sytem- Magento EAV Model
 
Implementation of EAV pattern for ActiveRecord models
Implementation of EAV pattern for ActiveRecord modelsImplementation of EAV pattern for ActiveRecord models
Implementation of EAV pattern for ActiveRecord models
 
Angular 2 introduction
Angular 2 introductionAngular 2 introduction
Angular 2 introduction
 
Oleksandr Masovets. Forms in Drupal. Drupal Camp Kyiv 2011
Oleksandr Masovets. Forms in Drupal. Drupal Camp Kyiv 2011Oleksandr Masovets. Forms in Drupal. Drupal Camp Kyiv 2011
Oleksandr Masovets. Forms in Drupal. Drupal Camp Kyiv 2011
 
Why SOLID matters - even for JavaScript
Why SOLID matters - even for JavaScriptWhy SOLID matters - even for JavaScript
Why SOLID matters - even for JavaScript
 
No internet? No Problem!
No internet? No Problem!No internet? No Problem!
No internet? No Problem!
 
Summer - The HTML5 Library for Java and Scala
Summer - The HTML5 Library for Java and ScalaSummer - The HTML5 Library for Java and Scala
Summer - The HTML5 Library for Java and Scala
 
L13: Scripting
L13: ScriptingL13: Scripting
L13: Scripting
 

Destaque

Document management system using liferay 7
Document management system using liferay 7Document management system using liferay 7
Document management system using liferay 7Dhanraj Dadhich
 
Building a Hyper-Secure VPC on AWS with Puppet - PuppetConf 2013
Building a Hyper-Secure VPC on AWS with Puppet - PuppetConf 2013Building a Hyper-Secure VPC on AWS with Puppet - PuppetConf 2013
Building a Hyper-Secure VPC on AWS with Puppet - PuppetConf 2013Puppet
 
Interoperable Web Services with JAX-WS
Interoperable Web Services with JAX-WSInteroperable Web Services with JAX-WS
Interoperable Web Services with JAX-WSCarol McDonald
 

Destaque (6)

Java Concurrency
Java ConcurrencyJava Concurrency
Java Concurrency
 
Document management system using liferay 7
Document management system using liferay 7Document management system using liferay 7
Document management system using liferay 7
 
Java Persistence API
Java Persistence APIJava Persistence API
Java Persistence API
 
Java Generics
Java GenericsJava Generics
Java Generics
 
Building a Hyper-Secure VPC on AWS with Puppet - PuppetConf 2013
Building a Hyper-Secure VPC on AWS with Puppet - PuppetConf 2013Building a Hyper-Secure VPC on AWS with Puppet - PuppetConf 2013
Building a Hyper-Secure VPC on AWS with Puppet - PuppetConf 2013
 
Interoperable Web Services with JAX-WS
Interoperable Web Services with JAX-WSInteroperable Web Services with JAX-WS
Interoperable Web Services with JAX-WS
 

Semelhante a java ee 6 Petcatalog

A Complete Tour of JSF 2
A Complete Tour of JSF 2A Complete Tour of JSF 2
A Complete Tour of JSF 2Jim Driscoll
 
Struts2
Struts2Struts2
Struts2yuvalb
 
JSP Standart Tag Lİbrary - JSTL
JSP Standart Tag Lİbrary - JSTLJSP Standart Tag Lİbrary - JSTL
JSP Standart Tag Lİbrary - JSTLseleciii44
 
Introducing Struts 2
Introducing Struts 2Introducing Struts 2
Introducing Struts 2wiradikusuma
 
Introduction to Spring MVC
Introduction to Spring MVCIntroduction to Spring MVC
Introduction to Spring MVCRichard Paul
 
Lerman Vvs14 Ef Tips And Tricks
Lerman Vvs14  Ef Tips And TricksLerman Vvs14  Ef Tips And Tricks
Lerman Vvs14 Ef Tips And TricksJulie Lerman
 
Intro Open Social and Dashboards
Intro Open Social and DashboardsIntro Open Social and Dashboards
Intro Open Social and DashboardsAtlassian
 
JSF 2.0 (JavaEE Webinar)
JSF 2.0 (JavaEE Webinar)JSF 2.0 (JavaEE Webinar)
JSF 2.0 (JavaEE Webinar)Roger Kitain
 
Introduction to JSF
Introduction toJSFIntroduction toJSF
Introduction to JSFSoftServe
 
Building AOL's High Performance, Enterprise Wide Mail Application With Silver...
Building AOL's High Performance, Enterprise Wide Mail Application With Silver...Building AOL's High Performance, Enterprise Wide Mail Application With Silver...
Building AOL's High Performance, Enterprise Wide Mail Application With Silver...goodfriday
 
Ruby on rails
Ruby on rails Ruby on rails
Ruby on rails Mohit Jain
 
Itemscript, a specification for RESTful JSON integration
Itemscript, a specification for RESTful JSON integrationItemscript, a specification for RESTful JSON integration
Itemscript, a specification for RESTful JSON integration{item:foo}
 
AJAX Workshop Notes
AJAX Workshop NotesAJAX Workshop Notes
AJAX Workshop NotesPamela Fox
 

Semelhante a java ee 6 Petcatalog (20)

JavaEE Spring Seam
JavaEE Spring SeamJavaEE Spring Seam
JavaEE Spring Seam
 
A Complete Tour of JSF 2
A Complete Tour of JSF 2A Complete Tour of JSF 2
A Complete Tour of JSF 2
 
Struts2
Struts2Struts2
Struts2
 
JSP Standart Tag Lİbrary - JSTL
JSP Standart Tag Lİbrary - JSTLJSP Standart Tag Lİbrary - JSTL
JSP Standart Tag Lİbrary - JSTL
 
Introducing Struts 2
Introducing Struts 2Introducing Struts 2
Introducing Struts 2
 
Os Leonard
Os LeonardOs Leonard
Os Leonard
 
Introduction to Spring MVC
Introduction to Spring MVCIntroduction to Spring MVC
Introduction to Spring MVC
 
Wpf Introduction
Wpf IntroductionWpf Introduction
Wpf Introduction
 
Jsf Ajax
Jsf AjaxJsf Ajax
Jsf Ajax
 
Lerman Vvs14 Ef Tips And Tricks
Lerman Vvs14  Ef Tips And TricksLerman Vvs14  Ef Tips And Tricks
Lerman Vvs14 Ef Tips And Tricks
 
Intro Open Social and Dashboards
Intro Open Social and DashboardsIntro Open Social and Dashboards
Intro Open Social and Dashboards
 
Struts Overview
Struts OverviewStruts Overview
Struts Overview
 
JSF 2.0 (JavaEE Webinar)
JSF 2.0 (JavaEE Webinar)JSF 2.0 (JavaEE Webinar)
JSF 2.0 (JavaEE Webinar)
 
Jsfsunum
JsfsunumJsfsunum
Jsfsunum
 
Introduction to JSF
Introduction toJSFIntroduction toJSF
Introduction to JSF
 
displaytag
displaytagdisplaytag
displaytag
 
Building AOL's High Performance, Enterprise Wide Mail Application With Silver...
Building AOL's High Performance, Enterprise Wide Mail Application With Silver...Building AOL's High Performance, Enterprise Wide Mail Application With Silver...
Building AOL's High Performance, Enterprise Wide Mail Application With Silver...
 
Ruby on rails
Ruby on rails Ruby on rails
Ruby on rails
 
Itemscript, a specification for RESTful JSON integration
Itemscript, a specification for RESTful JSON integrationItemscript, a specification for RESTful JSON integration
Itemscript, a specification for RESTful JSON integration
 
AJAX Workshop Notes
AJAX Workshop NotesAJAX Workshop Notes
AJAX Workshop Notes
 

Mais de Carol McDonald

Introduction to machine learning with GPUs
Introduction to machine learning with GPUsIntroduction to machine learning with GPUs
Introduction to machine learning with GPUsCarol McDonald
 
Streaming healthcare Data pipeline using Apache APIs: Kafka and Spark with Ma...
Streaming healthcare Data pipeline using Apache APIs: Kafka and Spark with Ma...Streaming healthcare Data pipeline using Apache APIs: Kafka and Spark with Ma...
Streaming healthcare Data pipeline using Apache APIs: Kafka and Spark with Ma...Carol McDonald
 
Analyzing Flight Delays with Apache Spark, DataFrames, GraphFrames, and MapR-DB
Analyzing Flight Delays with Apache Spark, DataFrames, GraphFrames, and MapR-DBAnalyzing Flight Delays with Apache Spark, DataFrames, GraphFrames, and MapR-DB
Analyzing Flight Delays with Apache Spark, DataFrames, GraphFrames, and MapR-DBCarol McDonald
 
Analysis of Popular Uber Locations using Apache APIs: Spark Machine Learning...
Analysis of Popular Uber Locations using Apache APIs:  Spark Machine Learning...Analysis of Popular Uber Locations using Apache APIs:  Spark Machine Learning...
Analysis of Popular Uber Locations using Apache APIs: Spark Machine Learning...Carol McDonald
 
Predicting Flight Delays with Spark Machine Learning
Predicting Flight Delays with Spark Machine LearningPredicting Flight Delays with Spark Machine Learning
Predicting Flight Delays with Spark Machine LearningCarol McDonald
 
Structured Streaming Data Pipeline Using Kafka, Spark, and MapR-DB
Structured Streaming Data Pipeline Using Kafka, Spark, and MapR-DBStructured Streaming Data Pipeline Using Kafka, Spark, and MapR-DB
Structured Streaming Data Pipeline Using Kafka, Spark, and MapR-DBCarol McDonald
 
Streaming Machine learning Distributed Pipeline for Real-Time Uber Data Using...
Streaming Machine learning Distributed Pipeline for Real-Time Uber Data Using...Streaming Machine learning Distributed Pipeline for Real-Time Uber Data Using...
Streaming Machine learning Distributed Pipeline for Real-Time Uber Data Using...Carol McDonald
 
Applying Machine Learning to IOT: End to End Distributed Pipeline for Real-Ti...
Applying Machine Learning to IOT: End to End Distributed Pipeline for Real-Ti...Applying Machine Learning to IOT: End to End Distributed Pipeline for Real-Ti...
Applying Machine Learning to IOT: End to End Distributed Pipeline for Real-Ti...Carol McDonald
 
Applying Machine Learning to IOT: End to End Distributed Pipeline for Real- T...
Applying Machine Learning to IOT: End to End Distributed Pipeline for Real- T...Applying Machine Learning to IOT: End to End Distributed Pipeline for Real- T...
Applying Machine Learning to IOT: End to End Distributed Pipeline for Real- T...Carol McDonald
 
How Big Data is Reducing Costs and Improving Outcomes in Health Care
How Big Data is Reducing Costs and Improving Outcomes in Health CareHow Big Data is Reducing Costs and Improving Outcomes in Health Care
How Big Data is Reducing Costs and Improving Outcomes in Health CareCarol McDonald
 
Demystifying AI, Machine Learning and Deep Learning
Demystifying AI, Machine Learning and Deep LearningDemystifying AI, Machine Learning and Deep Learning
Demystifying AI, Machine Learning and Deep LearningCarol McDonald
 
Applying Machine learning to IOT: End to End Distributed Distributed Pipeline...
Applying Machine learning to IOT: End to End Distributed Distributed Pipeline...Applying Machine learning to IOT: End to End Distributed Distributed Pipeline...
Applying Machine learning to IOT: End to End Distributed Distributed Pipeline...Carol McDonald
 
Streaming patterns revolutionary architectures
Streaming patterns revolutionary architectures Streaming patterns revolutionary architectures
Streaming patterns revolutionary architectures Carol McDonald
 
Spark machine learning predicting customer churn
Spark machine learning predicting customer churnSpark machine learning predicting customer churn
Spark machine learning predicting customer churnCarol McDonald
 
Fast Cars, Big Data How Streaming can help Formula 1
Fast Cars, Big Data How Streaming can help Formula 1Fast Cars, Big Data How Streaming can help Formula 1
Fast Cars, Big Data How Streaming can help Formula 1Carol McDonald
 
Applying Machine Learning to Live Patient Data
Applying Machine Learning to  Live Patient DataApplying Machine Learning to  Live Patient Data
Applying Machine Learning to Live Patient DataCarol McDonald
 
Streaming Patterns Revolutionary Architectures with the Kafka API
Streaming Patterns Revolutionary Architectures with the Kafka APIStreaming Patterns Revolutionary Architectures with the Kafka API
Streaming Patterns Revolutionary Architectures with the Kafka APICarol McDonald
 
Apache Spark Machine Learning Decision Trees
Apache Spark Machine Learning Decision TreesApache Spark Machine Learning Decision Trees
Apache Spark Machine Learning Decision TreesCarol McDonald
 
Advanced Threat Detection on Streaming Data
Advanced Threat Detection on Streaming DataAdvanced Threat Detection on Streaming Data
Advanced Threat Detection on Streaming DataCarol McDonald
 

Mais de Carol McDonald (20)

Introduction to machine learning with GPUs
Introduction to machine learning with GPUsIntroduction to machine learning with GPUs
Introduction to machine learning with GPUs
 
Streaming healthcare Data pipeline using Apache APIs: Kafka and Spark with Ma...
Streaming healthcare Data pipeline using Apache APIs: Kafka and Spark with Ma...Streaming healthcare Data pipeline using Apache APIs: Kafka and Spark with Ma...
Streaming healthcare Data pipeline using Apache APIs: Kafka and Spark with Ma...
 
Analyzing Flight Delays with Apache Spark, DataFrames, GraphFrames, and MapR-DB
Analyzing Flight Delays with Apache Spark, DataFrames, GraphFrames, and MapR-DBAnalyzing Flight Delays with Apache Spark, DataFrames, GraphFrames, and MapR-DB
Analyzing Flight Delays with Apache Spark, DataFrames, GraphFrames, and MapR-DB
 
Analysis of Popular Uber Locations using Apache APIs: Spark Machine Learning...
Analysis of Popular Uber Locations using Apache APIs:  Spark Machine Learning...Analysis of Popular Uber Locations using Apache APIs:  Spark Machine Learning...
Analysis of Popular Uber Locations using Apache APIs: Spark Machine Learning...
 
Predicting Flight Delays with Spark Machine Learning
Predicting Flight Delays with Spark Machine LearningPredicting Flight Delays with Spark Machine Learning
Predicting Flight Delays with Spark Machine Learning
 
Structured Streaming Data Pipeline Using Kafka, Spark, and MapR-DB
Structured Streaming Data Pipeline Using Kafka, Spark, and MapR-DBStructured Streaming Data Pipeline Using Kafka, Spark, and MapR-DB
Structured Streaming Data Pipeline Using Kafka, Spark, and MapR-DB
 
Streaming Machine learning Distributed Pipeline for Real-Time Uber Data Using...
Streaming Machine learning Distributed Pipeline for Real-Time Uber Data Using...Streaming Machine learning Distributed Pipeline for Real-Time Uber Data Using...
Streaming Machine learning Distributed Pipeline for Real-Time Uber Data Using...
 
Applying Machine Learning to IOT: End to End Distributed Pipeline for Real-Ti...
Applying Machine Learning to IOT: End to End Distributed Pipeline for Real-Ti...Applying Machine Learning to IOT: End to End Distributed Pipeline for Real-Ti...
Applying Machine Learning to IOT: End to End Distributed Pipeline for Real-Ti...
 
Applying Machine Learning to IOT: End to End Distributed Pipeline for Real- T...
Applying Machine Learning to IOT: End to End Distributed Pipeline for Real- T...Applying Machine Learning to IOT: End to End Distributed Pipeline for Real- T...
Applying Machine Learning to IOT: End to End Distributed Pipeline for Real- T...
 
How Big Data is Reducing Costs and Improving Outcomes in Health Care
How Big Data is Reducing Costs and Improving Outcomes in Health CareHow Big Data is Reducing Costs and Improving Outcomes in Health Care
How Big Data is Reducing Costs and Improving Outcomes in Health Care
 
Demystifying AI, Machine Learning and Deep Learning
Demystifying AI, Machine Learning and Deep LearningDemystifying AI, Machine Learning and Deep Learning
Demystifying AI, Machine Learning and Deep Learning
 
Spark graphx
Spark graphxSpark graphx
Spark graphx
 
Applying Machine learning to IOT: End to End Distributed Distributed Pipeline...
Applying Machine learning to IOT: End to End Distributed Distributed Pipeline...Applying Machine learning to IOT: End to End Distributed Distributed Pipeline...
Applying Machine learning to IOT: End to End Distributed Distributed Pipeline...
 
Streaming patterns revolutionary architectures
Streaming patterns revolutionary architectures Streaming patterns revolutionary architectures
Streaming patterns revolutionary architectures
 
Spark machine learning predicting customer churn
Spark machine learning predicting customer churnSpark machine learning predicting customer churn
Spark machine learning predicting customer churn
 
Fast Cars, Big Data How Streaming can help Formula 1
Fast Cars, Big Data How Streaming can help Formula 1Fast Cars, Big Data How Streaming can help Formula 1
Fast Cars, Big Data How Streaming can help Formula 1
 
Applying Machine Learning to Live Patient Data
Applying Machine Learning to  Live Patient DataApplying Machine Learning to  Live Patient Data
Applying Machine Learning to Live Patient Data
 
Streaming Patterns Revolutionary Architectures with the Kafka API
Streaming Patterns Revolutionary Architectures with the Kafka APIStreaming Patterns Revolutionary Architectures with the Kafka API
Streaming Patterns Revolutionary Architectures with the Kafka API
 
Apache Spark Machine Learning Decision Trees
Apache Spark Machine Learning Decision TreesApache Spark Machine Learning Decision Trees
Apache Spark Machine Learning Decision Trees
 
Advanced Threat Detection on Streaming Data
Advanced Threat Detection on Streaming DataAdvanced Threat Detection on Streaming Data
Advanced Threat Detection on Streaming Data
 

java ee 6 Petcatalog

  • 1. JavaEE 6 Pet Catalog Carol McDonald Java Architect
  • 2.
  • 3.
  • 4. Pharmaceutical Intranet apps ( Roche Switzerland)
  • 5. Telecom Network Mgmt ( Digital France)
  • 6. X.400 Email Server ( IBM Germany)
  • 8. Catalog Java EE Application DB Registration Application Managed Bean JSF Components Session Bean Entity Class Catalog Item ManagedBean
  • 9. Simple Mapping Mapping defaults to matching column name . Only configure if entity field and table column names are different public class Item { int id; String name; String description; String url ; } @Entity @Column(name=“DECS”) @Id Item ID NAME DESC URL
  • 10. Catalog Java EE Application DB Registration Application Managed Bean JSF Components Session Bean Entity Class Catalog Item ManagedBean
  • 11. Stateless Session EJB, JPA Query @Stateless public class ItemDAO @PersistenceContext(unitName=”PetCatalogPu”) EntityManager em; public List<Item> findRange (int firstItem , int batchSize ) { Query q = em . createQuery (&quot; select i from Item as i &quot;); q. setMaxResults ( batchSize ); q. setFirstResult ( firstItem ); return q.getResultList(); } }
  • 12. JSF Component, Event Driven Web Framework Pages composed of server side components View Root Form id=guess Managed Bean getUserNumber() setUserNumber(..) guess() Business Service guess() Events call ManagedBean methods UIIput id=guessNum UICommand id=submit
  • 13. What is a JSF UI Component? Some Standard Components
  • 14. JSF Web Framework View Controller Model Request Service Interface Events
  • 15. Catalog Java EE Application DB Registration Application Managed Bean JSF Components Session Bean Entity Class Catalog Item ManagedBean
  • 16. List Items page Data Table
  • 17. list.xhtml Page < h:dataTable var=&quot; row &quot; value=&quot;#{ catalog.items }&quot;> <h:column> … < h:commandLink action=&quot;#{ catalog.showDetail ( row )}&quot; value=&quot;#{ row.name }&quot; /> <h:column> ... < h:graphicImage name=&quot;#{ row.imagethumburl }&quot; /> … <h:column> < h:outputTex t value =&quot;#{ row.price }&quot;/> ... </h:dataTable>
  • 18. Binding UI to Managed Bean list.xhtml <h: dataTable value =&quot;#{ catalog .items }&quot; @ManagedBean (name = &quot;Catalog&quot;) @SessionScoped public class Catalog { }
  • 19.
  • 20. list.xhtml Page < h:dataTable var=&quot; row &quot; value=&quot;#{ catalog.items }&quot;> <h:column> … < h:commandLink action=&quot;#{ catalog.showDetail ( row )}&quot; value=&quot;#{ row.name }&quot; /> <h:column> ... < h:graphicImage name=&quot;#{ row.imagethumburl }&quot; /> … <h:column> < h:outputTex t value =&quot;#{ row.price }&quot;/> ... </h:dataTable>
  • 21. UIComponents Binding to a Managed Bean public class Catalog { private List<Item> items = null; public List<Item> getItems() { . . . return items; } . . . } <h: dataTable value =&quot;#{ catalog .items }&quot; Managed Bean property Managed Bean dataTable useful to show a Collection in a table Client Server A B C Backing Bean Form c1 A c2 B c3 C c1 c2 c3 A B C Page
  • 22. Managed Bean: ItemController public class ItemController { private List<Item> items = null; @EJB private ItemDAO itemDAO ; public List<Item> getItems() { getPagingInfo(); return itemDAO.findRange(pagingInfo.getBatchSize(), pagingInfo.getFirstItem()); } . . .
  • 23. Relationship Between Objects findRange() via EntityBean #{catalog.items} Item Entity ItemDAO Catalog list.xhtml
  • 24. List Items page Link to see Item Details
  • 25. list.jsp <h:dataTable var=&quot;row&quot; value=&quot;#{catalog.items}&quot; > <h:column> <f:facet name=&quot;header&quot;> <h:outputText value=&quot;#{msgs.Name}&quot;/> </f:facet> <h :commandLink action = &quot;#{catalog.showDetail(row)}&quot; value=&quot;#{row.name}&quot; /> </h:column> <h:column> <f:facet name=&quot;header&quot;> <h:outputText value=&quot;#{msgs.Photo}&quot;/> </f:facet> <h:graphicImage library=&quot;images&quot; name=&quot;#{row.imagethumburl}&quot;/> </h:column> <h:column> <f:facet name=&quot;header&quot;> <h:outputText value=&quot;#{msgs.Price}&quot;/> </f:facet> <h:outputText value=&quot;#{row.price}&quot; /> </h:column> </h:dataTable> Click causes Action Event
  • 26. JSF controller handles action events, such as submitting a form or linking to another page. JSF Standard request processing lifecycle Request Restore View Response Render Response Apply Request Values Invoke Application Update Model Values Process Validations action events
  • 27.
  • 28. public String showDetail (Item item ) {
  • 31. }
  • 32. Standard request processing lifecycle JavaServer Faces Lifecycle Request Restore View Response Render Response Apply Request Values Invoke Application Update Model Values Process Validations
  • 34. detail.jsp . . . <h:form> <h: outputStylesheet name=&quot;css/styles.css&quot;/> <h:panelGrid columns=&quot;2&quot; border=&quot;0&quot; > <h:outputText value=&quot;#{ msgs.Name }:&quot;/> <h:outputText value=&quot;#{ catalog.item.name }&quot; title=&quot;Name&quot; /> <h:outputText value=&quot;#{ msgs.Description }:&quot;/> <h:outputText value=&quot;#{ catalog.item.description }&quot; title=&quot;Description&quot; /> <h:outputText value=&quot;#{msgs.Photo}:&quot;/> <h:graphicImage library=&quot;images&quot; name=&quot;#{catalog.item.imageurl}&quot; title=&quot;url&quot; /> <h:outputText value=&quot;#{msgs.Price}:&quot;/> <h:outputText value=&quot;#{catalog.item.price}&quot; title=&quot;Price&quot; /> </h:panelGrid> <h:commandButton id=&quot;back&quot; value=&quot;Back&quot; action=&quot;list&quot;/> </h:form> Calls itemController.getItem().getName()
  • 35. Resources <application> <resource-bundle> <base-name>web.WebMessages</base-name> <var>msgs</var> </resource-bundle> </application>
  • 36.
  • 37. private Item item ;
  • 38. public Item getItem() {
  • 41. JavaEE 6 Carol McDonald Java Architect Sun Microsystems

Notas do Editor

  1. To obtain an container managed EntityManager instance, inject the entity manager into the application component: @PersistenceContext EntityManager em; you don&apos;t need any cm lifecycle methods With a container-managed entity manager, an EntityManager instance&apos;s persistence context is automatically propagated by the container to all application components that use the EntityManager instance within a single Java Transaction Architecture (JTA) transaction. JTA transactions usually involve calls across application components. To complete a JTA transaction, these components usually need access to a single persistence context. This occurs when an EntityManager is injected into the application components via the javax.persistence.PersistenceContext annotation. The persistence context is automatically propagated with the current JTA transaction, and EntityManager references that are mapped to the same persistence unit provide access to the persistence context within that transaction. By automatically propagating the persistence context, application components don&apos;t need to pass references to EntityManager instances to each other in order to make changes within a single transaction. The Java EE container manages the lifecycle of container-managed entity managers.
  2. note the taglib declaration. JSF comes with its own set of JSP custom tag libraries. Here we declare two JSF tag libraries, html and core. The html JSF tag library contains HTML rendering tags while the core JSF tag library contains JSF core tags. These libraries expose most of the JSF components, validators, event registers, and so on. Note that there are several UI components in this page. And they are &lt;h:output_text&gt;, &lt;h:inputText&gt;, &lt;h:commandButton&gt;. The &lt;h:output_text&gt;elements contains value attributes whose values come from the property values of a JavaBean called UserNumberBean. The names of these properties of this bean are called minimum and maximum. The &lt;h:inputText&gt; element displays the userNumber property of the UserNumberBean and also prompts the user to enter a new number in the textfield. The &lt;h:commandButton&gt; displays a button that can be pressed for submitting the form data. ·form tag represents an input form with which the user can submit data to the server.
  3. This slide shows the relationship between JSP page and backing bean declaration in the application configuration file. Every backing bean needs to be declared in the application configuration file. Here in this guessNumber example, there is only one bean called UserNumberBean, which has two properties called minimum and maximum whose types and initial values are also defined. In the JSP page, you refer to these properties using JSF EL expression notation like #{UserNumberBean.minimum} or #{UserNumberBean.maximum}. to provide an event-based, JavaBean model way of interacting with application data, JavaServer Faces provides an easy-to-use mechanism by which Web-accessible user interface components are bound to server-side JavaBeans that are registered as &amp;quot;Managed Beans&amp;quot; in an XML file (faces-config.xml). Beans are bound to a user interface with a simple-to-use Expression Language, which is almost identical to JSTL&apos;s Expression Language syntax.
  4. note the taglib declaration. JSF comes with its own set of JSP custom tag libraries. Here we declare two JSF tag libraries, html and core. The html JSF tag library contains HTML rendering tags while the core JSF tag library contains JSF core tags. These libraries expose most of the JSF components, validators, event registers, and so on. Note that there are several UI components in this page. And they are &lt;h:output_text&gt;, &lt;h:inputText&gt;, &lt;h:commandButton&gt;. The &lt;h:output_text&gt;elements contains value attributes whose values come from the property values of a JavaBean called UserNumberBean. The names of these properties of this bean are called minimum and maximum. The &lt;h:inputText&gt; element displays the userNumber property of the UserNumberBean and also prompts the user to enter a new number in the textfield. The &lt;h:commandButton&gt; displays a button that can be pressed for submitting the form data. ·form tag represents an input form with which the user can submit data to the server.
  5. The value attribute of a dataTable tag references the data to be included in the table. The var attribute specifies a name that is used by the components within the dataTable tag as an alias to the data referenced in the value attribute of dataTable. In the dataTable tag from the List.jsp page, the value attribute points to a list of catalog items. The var attribute points to a single item in that list. As the UIData component iterates through the list, each reference to dataTableItem points to the current item in the list.
  6. getItems() method wraps a List of items, returned from the CatalogFacade Stateless Session EJB, in a DataModel. dataTable, supports data binding to a collection of data objects represented by a DataModel instance, which is the current value of this component itself. The data collection underlying a DataModel instance is modeled as a collection of row objects that can be accessed by a row index. The APIs provide mechanisms to position to a specified row index, and to retrieve an object that represents the data that corresponds to the current row index.
  7. note the taglib declaration. JSF comes with its own set of JSP custom tag libraries. Here we declare two JSF tag libraries, html and core. The html JSF tag library contains HTML rendering tags while the core JSF tag library contains JSF core tags. These libraries expose most of the JSF components, validators, event registers, and so on. Note that there are several UI components in this page. And they are &lt;h:output_text&gt;, &lt;h:inputText&gt;, &lt;h:commandButton&gt;. The &lt;h:output_text&gt;elements contains value attributes whose values come from the property values of a JavaBean called UserNumberBean. The names of these properties of this bean are called minimum and maximum. The &lt;h:inputText&gt; element displays the userNumber property of the UserNumberBean and also prompts the user to enter a new number in the textfield. The &lt;h:commandButton&gt; displays a button that can be pressed for submitting the form data. ·form tag represents an input form with which the user can submit data to the server.
  8. At the invoke application phase– the JSF controller invokes the application to handle Form submissions. The component values will have been converted, validated, and applied to the model objects, so you can now use them to execute the application&apos;s business logic. At this phase, you also get to specify the next logical view for a given sequence or number of possible sequences. You do this by defining a specific outcome for a successful form submission and returning that outcome. For example: on successful outcome, move the user to the next page. For this navigation to work, you will have to create a mapping to the successful outcome as a navigation rule in the faces-config.xml file. Once the navigation occurs, you move to the final phase of the lifecycle.
  9. note the taglib declaration. JSF comes with its own set of JSP custom tag libraries. Here we declare two JSF tag libraries, html and core. The html JSF tag library contains HTML rendering tags while the core JSF tag library contains JSF core tags. These libraries expose most of the JSF components, validators, event registers, and so on. Note that there are several UI components in this page. And they are &lt;h:output_text&gt;, &lt;h:inputText&gt;, &lt;h:commandButton&gt;. The &lt;h:output_text&gt;elements contains value attributes whose values come from the property values of a JavaBean called UserNumberBean. The names of these properties of this bean are called minimum and maximum. The &lt;h:inputText&gt; element displays the userNumber property of the UserNumberBean and also prompts the user to enter a new number in the textfield. The &lt;h:commandButton&gt; displays a button that can be pressed for submitting the form data. ·form tag represents an input form with which the user can submit data to the server.
  10. At the invoke application phase– the JSF controller invokes the application to handle Form submissions. The component values will have been converted, validated, and applied to the model objects, so you can now use them to execute the application&apos;s business logic. At this phase, you also get to specify the next logical view for a given sequence or number of possible sequences. You do this by defining a specific outcome for a successful form submission and returning that outcome. For example: on successful outcome, move the user to the next page. For this navigation to work, you will have to create a mapping to the successful outcome as a navigation rule in the faces-config.xml file. Once the navigation occurs, you move to the final phase of the lifecycle.