SlideShare a Scribd company logo
Java EE Web project
Contents
● Java EE project setup
● Introduction to Maven
● Web application structure
● JSF basics
● CDI basics
● GIT overview (optional)
Java EE project setup in Eclipse
Prerequisites:
● Eclipse Luna
● WildFly application server
● Maven support in Eclipse - m2eclipse
● Git support in Eclipse eGIT
● JBoss Tools for Eclipse
● Download prepared sources from GitHub
Java EE project setup in Netbeans
Prerequisites:
● Netbeans 7 or 8
● Glassfish application server
● Download prepared sources from GitHub
DEMO
Presentation of the demo application in IDE
and running on app server
Introduction to Maven
● project build and configuration tool
● it can:
o execute build tasks using command line
o automatically download necessary libriaries
(dependencies)
o configure project independently from IDE
Introduction to Maven - artifacts
Artifacts are files produced by a maven build.
They are specified by:
● groupId
● artifactId
● version
● packaging - JAR, WAR, EJB, EAR, POM, ...
An artifact can be dependency of another module
Maven - goals and phases
To execute maven build: > mvn goal
Goal can be a name of phase that we want to complete. All phases before that
phase are completed in order.
The order of basic maven phases:
compile, test, package, integration-test, install
Steps to complete each phase may differ between module
types (packging)
Maven - dependencies
Specified by: groupId, artifactId, version, type
(jar is default type)
Scope of a dependency:
● compile (default)
● test - only used when running unit tests
● provided - not included in artifact
DEMO
Example of Maven pom.xml.
Example of running maven in IDE.
Multitiered application model
Java EE Web application
In simplest for a single WAR file.
● WEB-INF folder
o web.xml
o faces-config.xml
o optionally beans.xml for CDI
o classes folder with compiled java classes
● web resources in root folder
o JSF facelets, css, images, etc.
WAR Maven module
Single module of type WAR
● pom.xml specifies:
o packaging WAR
o dependency on javaee-api (scope=provided)
● src/main/java - java sources
● src/main/webapp - Web resources
● src/main/resources - classpath resources
JSF overview
● run by FacesServlet mapped in web.xml
● configured by faces-config.xml and contex
parameters in web.xml
● FacesServlet executes several phases in
MVC style
o Request -> Execute code in Java Bean -> Create
view from Facelet -> Response
JSF lifecycle
● Restore view phase
● Apply request values phase; process events
● Process validations phase; process events
● Update model values phase; process events
● Invoke application phase; process events
● Render response phase
JSF Lifecycle
JSF component tree
● logical tree of UI components
● created from a definition in facelet
● encoded to xhtml at the end of the request
o to bring new state of the view to browser (new page)
● recreated at the begining of the request
o to represent the current state of the view before
request is processed
JSF Facelets
● XHTML based templates for a web page
● define components in a component tree
● specify binding to Java code
o data
o conditional rendering
o controller methods / listeners
JSF Managed Beans
● provide controller methods and data model
for facelets
● bound to component properties using
Expression Language
● identified in facelets by textual name
● marked by @Named CDI qualifier
Expression language
EL is a script used in facelets to bind values to
component properties
● Results in a value - primitive values, object,
even a method pointer
● Fields are converted to getters and setters
● Never throws a Null Pointer -> blank value
instead
Usage of Expression language
● enclosed in #{ ... }
● do not mix with ${ … } used in JSP
o JSP and JSTL tags should not be mixed with JSF
● in facelet: rendered="#{ bookView.displayed }
● in BookView bean:
@Named class BookView {
public boolean isDisplayed() { return true; }
}
Basic components - display
● h:outputText - textual output in <span>
● h:outputLabel - <label>
● h:outputLink - <a href…>
● h:messages - display of JSF messages
● h:graphicImage - <img>
● h:dataTable - table for collection of rows
Basic components - layout
● h:panelGroup - container - <span> or <div>
● h:panelGrid - grid layout container (table)
Basic components - Forms
● h:inputText
● h:inputTextarea
● h:selectManyListbox, h:selectOneMenu, etc.
- selection components, listboxes,
checkboxes
● h:form - all input components must be in
some form to function
Basic components - actions
● All action components submit form and call
action on web server via javascript
● They accept link to a listener method
● h:commandButton
● h:commandLink
Contexts & Dependency Injection
● Injection: instead of myVar = Factory.getVar()
or myVar = new Var() declare that I need Var
● @Inject Var myVar
● instance of Var is created by the container
● works only in container managed beans
o JSF beans, Servlets, EJBs, all injected beans -
generally Java objects created by the container
Dependency injection rules
● never use “new” on a bean with a CDI
dependency
● all injected beans must have constructor
without parameters
● do not put initialization to constructor but to
method marked with @PostConstruct
Lifecycle of injected beans
● when bean created
o constructor is executed first
o then are dependencies injected
o method marked with @PostConstruct is called
● during injection, beans are either created or
reused
o it depends on current context of execution and
scope of injected bean
Basic scopes
● Dependent (default)
o a new bean is always created for injection
o similar to calling constructor directly
● Application scope
o single bean is created for whole application
o the same bean is reused afterwards, retaining its
complete state
o singleton pattern
Basic Java EE scopes
Most scopes are bound to a lifecycle of a
specific action
● Request scope
o bound to lifecycle of HTTP request
o within HTTP request, only single instance of request
scoped bean is created and reused
● Session scope
o bound to lifecycle of HTTP session
Java EE scope annotations
package javax.enterprise.context:
● Dependent (optional)
● ApplicationScoped
● RequestScoped
● SessionScoped
Only single instance of Java object with defined scope is created and
reused for single application, request, session
Dependency declaration
● inject by class
o inject instance of the class or its subclass
● inject by interface
o inject instance of java class with given interface
● inject by qualifier
o inject instance with given qualifier
o qualifier is a java annotation marked with @Qualifier
For one injection point, one class should match
Runtime / conditional injection
@Inject Instance<Var> myVarInjector;
…
myVar = myVarInjector.get();
● matching bean is resolved when necessary
● can be injected directly when needed
● resolution errors can be treted at runtime
Creating new CDI beans
● possible to create a completely new CDI
bean regardless of context
● @New annotation overrides bean scope
● can be used instead of new keyword:
@Inject @New Instance<Var> varInjector;
...Var myVar1 = varInjector.get();
...Var myVar2 = varInjector.get();
Producers
● CDI usually creates new beans via
constructor without parameters
● Producers allow to customize creation
● instead of a class, a method of a producer is
marked with annotations and scope
o this method returns created bean of matching type
o it is called when bean with the same definition is
requested
Producers - example
class MyVarProducer {
@Produces @RequestScoped
public Var createVar(@New Var var) {
var.setState("NEW");
return var;
}
}
Introduction to GIT
GIT is a source code version control system.
It is a distributed version control system.
● multiple repositories can be interconnected
and synchronized
GIT repository
● single instance of storage of versioned files
● stores latest version of files, history of
changes, metadata (commit messages), and
connection to other upstream repositories
● repositories are organized in a tree
o from upstream repositories to downstream
Simplest GIT topology
● Central GIT repository - accesible via public
link
o local GIT repository
o local GIT repository
o local GIT repository
● Local repositories exist only on local
computers
o they are created from central using clone command
2-step synchronisation
● clone - downloads new copy of repository
● edit files
o add (add new files if created)
o edited and removed files are already handled
● commit - save changes locally (checkpoint)
● pull - download changes from central repo
o merge and resolve conflicting changes
o commit if files changed
● push - upload locally commited changes

More Related Content

What's hot (20)

PPT
Banking system (final)
prabhjot7777
 
DOC
SYNOPSIS ON BANK MANAGEMENT SYSTEM
Nitish Xavier Tirkey
 
PDF
Project report
ARPITA SRIVASTAVA
 
PPT
Bank Management System
kartikeya upadhyay
 
PDF
Multi Banking System
TEJVEER SINGH
 
PPTX
Foodies- An e-Food inventory Management Portal
LJ PROJECTS
 
PDF
Project report
shailendra patidar
 
PDF
Srs for banking system
Jaydev Kishnani
 
PPTX
Event Management System Document
LJ PROJECTS
 
DOCX
A Software Engineering Project on Cyber cafe management
svrohith 9
 
PPTX
Srs present
Vidyas Gnanasekaram
 
PPTX
Cafeteria management system in sanothimi campus(cms) suresh
Nawaraj Ghimire
 
PPTX
Online examination system project ppt
Mohit Gupta
 
DOC
Object oriented programming
ashu6
 
DOC
14 online venue booking
Pvrtechnologies Nellore
 
PPTX
Wedding PlannerPresentation
Azmina Papeya
 
DOCX
Online movie ticket booking
mrinnovater007
 
DOCX
Srs
vipul0212
 
PDF
.Net and Windows Application Project on Hotel Management
Mujeeb Rehman
 
PPTX
2 d barcode based mobile payment system
Parag Tamhane
 
Banking system (final)
prabhjot7777
 
SYNOPSIS ON BANK MANAGEMENT SYSTEM
Nitish Xavier Tirkey
 
Project report
ARPITA SRIVASTAVA
 
Bank Management System
kartikeya upadhyay
 
Multi Banking System
TEJVEER SINGH
 
Foodies- An e-Food inventory Management Portal
LJ PROJECTS
 
Project report
shailendra patidar
 
Srs for banking system
Jaydev Kishnani
 
Event Management System Document
LJ PROJECTS
 
A Software Engineering Project on Cyber cafe management
svrohith 9
 
Srs present
Vidyas Gnanasekaram
 
Cafeteria management system in sanothimi campus(cms) suresh
Nawaraj Ghimire
 
Online examination system project ppt
Mohit Gupta
 
Object oriented programming
ashu6
 
14 online venue booking
Pvrtechnologies Nellore
 
Wedding PlannerPresentation
Azmina Papeya
 
Online movie ticket booking
mrinnovater007
 
.Net and Windows Application Project on Hotel Management
Mujeeb Rehman
 
2 d barcode based mobile payment system
Parag Tamhane
 

Viewers also liked (7)

PDF
Web Components for Java Developers
Joonas Lehtinen
 
PDF
Step by Step - Website planning (Strategic)
Vaibhav Vats
 
PPT
Online gas booking project in java
s4al_com
 
PPTX
Online Quiz System Project PPT
Shanthan Reddy
 
PPTX
Online quiz system
Satyaki Mitra
 
PDF
Montreal Girl Geeks: Building the Modern Web
Rachel Andrew
 
PPT
Creating a Website Sitemap
Jeannie Melinz
 
Web Components for Java Developers
Joonas Lehtinen
 
Step by Step - Website planning (Strategic)
Vaibhav Vats
 
Online gas booking project in java
s4al_com
 
Online Quiz System Project PPT
Shanthan Reddy
 
Online quiz system
Satyaki Mitra
 
Montreal Girl Geeks: Building the Modern Web
Rachel Andrew
 
Creating a Website Sitemap
Jeannie Melinz
 
Ad

Similar to Java EE web project introduction (20)

PDF
2-0. Spring ecosytem.pdf
DeoDuaNaoHet
 
PDF
tools cli java
TiNguyn863920
 
PDF
Make JSF more type-safe with CDI and MyFaces CODI
os890
 
PDF
Javascript as a target language - GWT KickOff - Part 2/2
JooinK
 
PDF
InterConnect 2016 Java EE 7 Overview (PEJ-5296)
Kevin Sutter
 
PPTX
Spring introduction
Lê Hảo
 
PPTX
Maven
Shraddha
 
ODP
Behat Workshop at WeLovePHP
Marcos Quesada
 
PDF
Haj 4328-java ee 7 overview
Kevin Sutter
 
PDF
Maven and j unit introduction
Sergii Fesenko
 
PPTX
React Basic and Advance || React Basic
rafaqathussainc077
 
PPTX
Java EE 6
Geert Pante
 
PDF
Hibernate 1x2
Meenakshi Chandrasekaran
 
PDF
Java EE 6 & GlassFish V3 - Alexis Moussine-Pouchkine - May 2010
JUG Lausanne
 
KEY
Play Support in Cloud Foundry
rajdeep
 
ODP
Spring 4 final xtr_presentation
sourabh aggarwal
 
PDF
Owner - Java properties reinvented.
Luigi Viggiano
 
ODP
eXo Platform SEA - Play Framework Introduction
vstorm83
 
PDF
Contextual Dependency Injection for Apachecon 2010
Rohit Kelapure
 
PDF
Introduction to Maven
Sperasoft
 
2-0. Spring ecosytem.pdf
DeoDuaNaoHet
 
tools cli java
TiNguyn863920
 
Make JSF more type-safe with CDI and MyFaces CODI
os890
 
Javascript as a target language - GWT KickOff - Part 2/2
JooinK
 
InterConnect 2016 Java EE 7 Overview (PEJ-5296)
Kevin Sutter
 
Spring introduction
Lê Hảo
 
Maven
Shraddha
 
Behat Workshop at WeLovePHP
Marcos Quesada
 
Haj 4328-java ee 7 overview
Kevin Sutter
 
Maven and j unit introduction
Sergii Fesenko
 
React Basic and Advance || React Basic
rafaqathussainc077
 
Java EE 6
Geert Pante
 
Java EE 6 & GlassFish V3 - Alexis Moussine-Pouchkine - May 2010
JUG Lausanne
 
Play Support in Cloud Foundry
rajdeep
 
Spring 4 final xtr_presentation
sourabh aggarwal
 
Owner - Java properties reinvented.
Luigi Viggiano
 
eXo Platform SEA - Play Framework Introduction
vstorm83
 
Contextual Dependency Injection for Apachecon 2010
Rohit Kelapure
 
Introduction to Maven
Sperasoft
 
Ad

More from Ondrej Mihályi (12)

PDF
Easily scale enterprise applications using distributed data grids
Ondrej Mihályi
 
PDF
Elastic and Cloud-ready Applications with Payara Micro
Ondrej Mihályi
 
PPTX
Bed con - MicroProfile: A Quest for a lightweight and reactive Enterprise Ja...
Ondrej Mihályi
 
PDF
Easily scale enterprise applications using distributed data grids
Ondrej Mihályi
 
ODP
How to bake_reactive_behavior_into_your_java_ee_applications
Ondrej Mihályi
 
ODP
How to bake reactive behavior into your Java EE applications
Ondrej Mihályi
 
ODP
How to bake reactive behavior into your Java EE applications
Ondrej Mihályi
 
ODP
How to bake reactive behavior into your Java EE applications
Ondrej Mihályi
 
ODP
How to bake reactive behavior into your Java EE applications
Ondrej Mihályi
 
ODP
Business layer and transactions
Ondrej Mihályi
 
ODP
Working with jpa
Ondrej Mihályi
 
ODP
Maven in Java EE project
Ondrej Mihályi
 
Easily scale enterprise applications using distributed data grids
Ondrej Mihályi
 
Elastic and Cloud-ready Applications with Payara Micro
Ondrej Mihályi
 
Bed con - MicroProfile: A Quest for a lightweight and reactive Enterprise Ja...
Ondrej Mihályi
 
Easily scale enterprise applications using distributed data grids
Ondrej Mihályi
 
How to bake_reactive_behavior_into_your_java_ee_applications
Ondrej Mihályi
 
How to bake reactive behavior into your Java EE applications
Ondrej Mihályi
 
How to bake reactive behavior into your Java EE applications
Ondrej Mihályi
 
How to bake reactive behavior into your Java EE applications
Ondrej Mihályi
 
How to bake reactive behavior into your Java EE applications
Ondrej Mihályi
 
Business layer and transactions
Ondrej Mihályi
 
Working with jpa
Ondrej Mihályi
 
Maven in Java EE project
Ondrej Mihályi
 

Recently uploaded (20)

PPTX
Reimaginando la Ciberdefensa: De Copilots a Redes de Agentes
Cristian Garcia G.
 
PDF
Dev Dives: Accelerating agentic automation with Autopilot for Everyone
UiPathCommunity
 
PDF
Next level data operations using Power Automate magic
Andries den Haan
 
PDF
Pipeline Industry IoT - Real Time Data Monitoring
Safe Software
 
PDF
Plugging AI into everything: Model Context Protocol Simplified.pdf
Abati Adewale
 
PDF
TrustArc Webinar - Navigating APAC Data Privacy Laws: Compliance & Challenges
TrustArc
 
PPTX
Enabling the Digital Artisan – keynote at ICOCI 2025
Alan Dix
 
PPTX
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
PPTX
MARTSIA: A Tool for Confidential Data Exchange via Public Blockchain - Poster...
Michele Kryston
 
DOCX
Daily Lesson Log MATATAG ICT TEchnology 8
LOIDAALMAZAN3
 
PDF
The Future of Product Management in AI ERA.pdf
Alyona Owens
 
PPTX
Smarter Governance with AI: What Every Board Needs to Know
OnBoard
 
PDF
Kubernetes - Architecture & Components.pdf
geethak285
 
PDF
GDG Cloud Southlake #44: Eyal Bukchin: Tightening the Kubernetes Feedback Loo...
James Anderson
 
PDF
Hyderabad MuleSoft In-Person Meetup (June 21, 2025) Slides
Ravi Tamada
 
PDF
Quantum AI Discoveries: Fractal Patterns Consciousness and Cyclical Universes
Saikat Basu
 
PDF
Darley - FIRST Copenhagen Lightning Talk (2025-06-26) Epochalypse 2038 - Time...
treyka
 
PDF
5 Things to Consider When Deploying AI in Your Enterprise
Safe Software
 
PPTX
Smart Factory Monitoring IIoT in Machine and Production Operations.pptx
Rejig Digital
 
PDF
Redefining Work in the Age of AI - What to expect? How to prepare? Why it mat...
Malinda Kapuruge
 
Reimaginando la Ciberdefensa: De Copilots a Redes de Agentes
Cristian Garcia G.
 
Dev Dives: Accelerating agentic automation with Autopilot for Everyone
UiPathCommunity
 
Next level data operations using Power Automate magic
Andries den Haan
 
Pipeline Industry IoT - Real Time Data Monitoring
Safe Software
 
Plugging AI into everything: Model Context Protocol Simplified.pdf
Abati Adewale
 
TrustArc Webinar - Navigating APAC Data Privacy Laws: Compliance & Challenges
TrustArc
 
Enabling the Digital Artisan – keynote at ICOCI 2025
Alan Dix
 
New ThousandEyes Product Innovations: Cisco Live June 2025
ThousandEyes
 
MARTSIA: A Tool for Confidential Data Exchange via Public Blockchain - Poster...
Michele Kryston
 
Daily Lesson Log MATATAG ICT TEchnology 8
LOIDAALMAZAN3
 
The Future of Product Management in AI ERA.pdf
Alyona Owens
 
Smarter Governance with AI: What Every Board Needs to Know
OnBoard
 
Kubernetes - Architecture & Components.pdf
geethak285
 
GDG Cloud Southlake #44: Eyal Bukchin: Tightening the Kubernetes Feedback Loo...
James Anderson
 
Hyderabad MuleSoft In-Person Meetup (June 21, 2025) Slides
Ravi Tamada
 
Quantum AI Discoveries: Fractal Patterns Consciousness and Cyclical Universes
Saikat Basu
 
Darley - FIRST Copenhagen Lightning Talk (2025-06-26) Epochalypse 2038 - Time...
treyka
 
5 Things to Consider When Deploying AI in Your Enterprise
Safe Software
 
Smart Factory Monitoring IIoT in Machine and Production Operations.pptx
Rejig Digital
 
Redefining Work in the Age of AI - What to expect? How to prepare? Why it mat...
Malinda Kapuruge
 

Java EE web project introduction

  • 1. Java EE Web project
  • 2. Contents ● Java EE project setup ● Introduction to Maven ● Web application structure ● JSF basics ● CDI basics ● GIT overview (optional)
  • 3. Java EE project setup in Eclipse Prerequisites: ● Eclipse Luna ● WildFly application server ● Maven support in Eclipse - m2eclipse ● Git support in Eclipse eGIT ● JBoss Tools for Eclipse ● Download prepared sources from GitHub
  • 4. Java EE project setup in Netbeans Prerequisites: ● Netbeans 7 or 8 ● Glassfish application server ● Download prepared sources from GitHub
  • 5. DEMO Presentation of the demo application in IDE and running on app server
  • 6. Introduction to Maven ● project build and configuration tool ● it can: o execute build tasks using command line o automatically download necessary libriaries (dependencies) o configure project independently from IDE
  • 7. Introduction to Maven - artifacts Artifacts are files produced by a maven build. They are specified by: ● groupId ● artifactId ● version ● packaging - JAR, WAR, EJB, EAR, POM, ... An artifact can be dependency of another module
  • 8. Maven - goals and phases To execute maven build: > mvn goal Goal can be a name of phase that we want to complete. All phases before that phase are completed in order. The order of basic maven phases: compile, test, package, integration-test, install Steps to complete each phase may differ between module types (packging)
  • 9. Maven - dependencies Specified by: groupId, artifactId, version, type (jar is default type) Scope of a dependency: ● compile (default) ● test - only used when running unit tests ● provided - not included in artifact
  • 10. DEMO Example of Maven pom.xml. Example of running maven in IDE.
  • 12. Java EE Web application In simplest for a single WAR file. ● WEB-INF folder o web.xml o faces-config.xml o optionally beans.xml for CDI o classes folder with compiled java classes ● web resources in root folder o JSF facelets, css, images, etc.
  • 13. WAR Maven module Single module of type WAR ● pom.xml specifies: o packaging WAR o dependency on javaee-api (scope=provided) ● src/main/java - java sources ● src/main/webapp - Web resources ● src/main/resources - classpath resources
  • 14. JSF overview ● run by FacesServlet mapped in web.xml ● configured by faces-config.xml and contex parameters in web.xml ● FacesServlet executes several phases in MVC style o Request -> Execute code in Java Bean -> Create view from Facelet -> Response
  • 15. JSF lifecycle ● Restore view phase ● Apply request values phase; process events ● Process validations phase; process events ● Update model values phase; process events ● Invoke application phase; process events ● Render response phase
  • 17. JSF component tree ● logical tree of UI components ● created from a definition in facelet ● encoded to xhtml at the end of the request o to bring new state of the view to browser (new page) ● recreated at the begining of the request o to represent the current state of the view before request is processed
  • 18. JSF Facelets ● XHTML based templates for a web page ● define components in a component tree ● specify binding to Java code o data o conditional rendering o controller methods / listeners
  • 19. JSF Managed Beans ● provide controller methods and data model for facelets ● bound to component properties using Expression Language ● identified in facelets by textual name ● marked by @Named CDI qualifier
  • 20. Expression language EL is a script used in facelets to bind values to component properties ● Results in a value - primitive values, object, even a method pointer ● Fields are converted to getters and setters ● Never throws a Null Pointer -> blank value instead
  • 21. Usage of Expression language ● enclosed in #{ ... } ● do not mix with ${ … } used in JSP o JSP and JSTL tags should not be mixed with JSF ● in facelet: rendered="#{ bookView.displayed } ● in BookView bean: @Named class BookView { public boolean isDisplayed() { return true; } }
  • 22. Basic components - display ● h:outputText - textual output in <span> ● h:outputLabel - <label> ● h:outputLink - <a href…> ● h:messages - display of JSF messages ● h:graphicImage - <img> ● h:dataTable - table for collection of rows
  • 23. Basic components - layout ● h:panelGroup - container - <span> or <div> ● h:panelGrid - grid layout container (table)
  • 24. Basic components - Forms ● h:inputText ● h:inputTextarea ● h:selectManyListbox, h:selectOneMenu, etc. - selection components, listboxes, checkboxes ● h:form - all input components must be in some form to function
  • 25. Basic components - actions ● All action components submit form and call action on web server via javascript ● They accept link to a listener method ● h:commandButton ● h:commandLink
  • 26. Contexts & Dependency Injection ● Injection: instead of myVar = Factory.getVar() or myVar = new Var() declare that I need Var ● @Inject Var myVar ● instance of Var is created by the container ● works only in container managed beans o JSF beans, Servlets, EJBs, all injected beans - generally Java objects created by the container
  • 27. Dependency injection rules ● never use “new” on a bean with a CDI dependency ● all injected beans must have constructor without parameters ● do not put initialization to constructor but to method marked with @PostConstruct
  • 28. Lifecycle of injected beans ● when bean created o constructor is executed first o then are dependencies injected o method marked with @PostConstruct is called ● during injection, beans are either created or reused o it depends on current context of execution and scope of injected bean
  • 29. Basic scopes ● Dependent (default) o a new bean is always created for injection o similar to calling constructor directly ● Application scope o single bean is created for whole application o the same bean is reused afterwards, retaining its complete state o singleton pattern
  • 30. Basic Java EE scopes Most scopes are bound to a lifecycle of a specific action ● Request scope o bound to lifecycle of HTTP request o within HTTP request, only single instance of request scoped bean is created and reused ● Session scope o bound to lifecycle of HTTP session
  • 31. Java EE scope annotations package javax.enterprise.context: ● Dependent (optional) ● ApplicationScoped ● RequestScoped ● SessionScoped Only single instance of Java object with defined scope is created and reused for single application, request, session
  • 32. Dependency declaration ● inject by class o inject instance of the class or its subclass ● inject by interface o inject instance of java class with given interface ● inject by qualifier o inject instance with given qualifier o qualifier is a java annotation marked with @Qualifier For one injection point, one class should match
  • 33. Runtime / conditional injection @Inject Instance<Var> myVarInjector; … myVar = myVarInjector.get(); ● matching bean is resolved when necessary ● can be injected directly when needed ● resolution errors can be treted at runtime
  • 34. Creating new CDI beans ● possible to create a completely new CDI bean regardless of context ● @New annotation overrides bean scope ● can be used instead of new keyword: @Inject @New Instance<Var> varInjector; ...Var myVar1 = varInjector.get(); ...Var myVar2 = varInjector.get();
  • 35. Producers ● CDI usually creates new beans via constructor without parameters ● Producers allow to customize creation ● instead of a class, a method of a producer is marked with annotations and scope o this method returns created bean of matching type o it is called when bean with the same definition is requested
  • 36. Producers - example class MyVarProducer { @Produces @RequestScoped public Var createVar(@New Var var) { var.setState("NEW"); return var; } }
  • 37. Introduction to GIT GIT is a source code version control system. It is a distributed version control system. ● multiple repositories can be interconnected and synchronized
  • 38. GIT repository ● single instance of storage of versioned files ● stores latest version of files, history of changes, metadata (commit messages), and connection to other upstream repositories ● repositories are organized in a tree o from upstream repositories to downstream
  • 39. Simplest GIT topology ● Central GIT repository - accesible via public link o local GIT repository o local GIT repository o local GIT repository ● Local repositories exist only on local computers o they are created from central using clone command
  • 40. 2-step synchronisation ● clone - downloads new copy of repository ● edit files o add (add new files if created) o edited and removed files are already handled ● commit - save changes locally (checkpoint) ● pull - download changes from central repo o merge and resolve conflicting changes o commit if files changed ● push - upload locally commited changes

Editor's Notes

  • #16: http://www.tutorialspoint.com/jsf/jsf_life_cycle.htm
  • #23: http://www.jsftoolbox.com/documentation/help/12-TagReference/html/h_panelGroup.html