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
Ad

More Related Content

What's hot (20)

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

Viewers also liked (7)

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

Similar to Java EE web project introduction (20)

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

More from Ondrej Mihályi (12)

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

Recently uploaded (20)

Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 
Cybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure ADCybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure AD
VICTOR MAESTRE RAMIREZ
 
Role of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered ManufacturingRole of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered Manufacturing
Andrew Leo
 
HCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser EnvironmentsHCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser Environments
panagenda
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)
Ortus Solutions, Corp
 
Rusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond SparkRusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond Spark
carlyakerly1
 
Mobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi ArabiaMobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi Arabia
Steve Jonas
 
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep DiveDesigning Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
ScyllaDB
 
What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...
Vishnu Singh Chundawat
 
How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?
Daniel Lehner
 
AI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global TrendsAI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global Trends
InData Labs
 
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded DevelopersLinux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Toradex
 
Cyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of securityCyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of security
riccardosl1
 
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes
 
Drupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy ConsumptionDrupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy Consumption
Exove
 
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven InsightsAndrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell
 
tecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdftecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdf
fjgm517
 
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In FranceManifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
chb3
 
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul
 
Linux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdfLinux Professional Institute LPIC-1 Exam.pdf
Linux Professional Institute LPIC-1 Exam.pdf
RHCSA Guru
 
Cybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure ADCybersecurity Identity and Access Solutions using Azure AD
Cybersecurity Identity and Access Solutions using Azure AD
VICTOR MAESTRE RAMIREZ
 
Role of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered ManufacturingRole of Data Annotation Services in AI-Powered Manufacturing
Role of Data Annotation Services in AI-Powered Manufacturing
Andrew Leo
 
HCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser EnvironmentsHCL Nomad Web – Best Practices and Managing Multiuser Environments
HCL Nomad Web – Best Practices and Managing Multiuser Environments
panagenda
 
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptxSpecial Meetup Edition - TDX Bengaluru Meetup #52.pptx
Special Meetup Edition - TDX Bengaluru Meetup #52.pptx
shyamraj55
 
Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)Into The Box Conference Keynote Day 1 (ITB2025)
Into The Box Conference Keynote Day 1 (ITB2025)
Ortus Solutions, Corp
 
Rusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond SparkRusty Waters: Elevating Lakehouses Beyond Spark
Rusty Waters: Elevating Lakehouses Beyond Spark
carlyakerly1
 
Mobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi ArabiaMobile App Development Company in Saudi Arabia
Mobile App Development Company in Saudi Arabia
Steve Jonas
 
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep DiveDesigning Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
Designing Low-Latency Systems with Rust and ScyllaDB: An Architectural Deep Dive
ScyllaDB
 
What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...What is Model Context Protocol(MCP) - The new technology for communication bw...
What is Model Context Protocol(MCP) - The new technology for communication bw...
Vishnu Singh Chundawat
 
How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?How Can I use the AI Hype in my Business Context?
How Can I use the AI Hype in my Business Context?
Daniel Lehner
 
AI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global TrendsAI and Data Privacy in 2025: Global Trends
AI and Data Privacy in 2025: Global Trends
InData Labs
 
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded DevelopersLinux Support for SMARC: How Toradex Empowers Embedded Developers
Linux Support for SMARC: How Toradex Empowers Embedded Developers
Toradex
 
Cyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of securityCyber Awareness overview for 2025 month of security
Cyber Awareness overview for 2025 month of security
riccardosl1
 
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes Partner Innovation Updates for May 2025
ThousandEyes
 
Drupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy ConsumptionDrupalcamp Finland – Measuring Front-end Energy Consumption
Drupalcamp Finland – Measuring Front-end Energy Consumption
Exove
 
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven InsightsAndrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell: Transforming Business Strategy Through Data-Driven Insights
Andrew Marnell
 
tecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdftecnologias de las primeras civilizaciones.pdf
tecnologias de las primeras civilizaciones.pdf
fjgm517
 
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In FranceManifest Pre-Seed Update | A Humanoid OEM Deeptech In France
Manifest Pre-Seed Update | A Humanoid OEM Deeptech In France
chb3
 
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul Shares 5 Steps to Implement AI Agents for Maximum Business Efficien...
Noah Loul
 

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