Jsf Spring
Using Spring with JSF 2.0
Originals of Slides and Source Code for Examples:
http://www.coreservlets.com/JSF-Tutorial/jsf2/
Customized Java EE Training: http://courses.coreservlets.com/
Servlets, JSP, JSF 2.0, Struts, Ajax, GWT 2.0, Spring, Hibernate, SOAP & RESTful Web Services, Java 6.
Developed and taught by well-known author and developer. At public venues or onsiteat your location.
© 2010 Marty Hall
For live training on JSF 1.x or 2.0, please see
courses at http://courses.coreservlets.com/.
htt
Taught by the author of Core Servlets and JSP, More
Servlets and JSP, and this tutorial. Available at public
Available
venues, or customized versions can be held on-site at
your organization.
• Courses developed and taught by Marty Hall
– Java 6,intermediate/beginning servlets/JSP, advanced servlets/JSP, Struts, JSF 1.x & 2.0, Ajax, GWT, custom mix of topics
– Ajax courses can concentrate on 1EE Training: http://courses.coreservlets.com/ or survey several
Customized Java library (jQuery, Prototype/Scriptaculous, Ext-JS, Dojo, Google Closure)
• Courses developed and taught by coreservlets.com experts (edited by Marty)
Servlets, Spring,Hibernate/JPA, EJB3, Ruby/Rails,2.0, Spring,and RESTful Web ServicesRESTful Web Services, Java 6.
– JSP, JSF 2.0, Struts, Ajax, GWT SOAP-based Hibernate, SOAP &
Contact hall@coreservlets.com for details
Developed and taught by well-known author and developer. At public venues or onsite at your location.
Topics in This Section
• Fast review of Spring dependency injection
• Configuring aJSF/Spring project in Eclipse
• Defining beans in two places
– JSF backing beans in faces-config.xml
– Spring beans in applicationContext.xml
• Defining beans in one place only
beans in one place only
– All beans in applicationContext.xml
5
© 2010 Marty Hall
Overview
Customized Java EE Training: http://courses.coreservlets.com/
Servlets, JSP, JSF 2.0, Struts, Ajax, GWT 2.0, Spring,Hibernate, SOAP & RESTful Web Services, Java 6.
Developed and taught by well-known author and developer. At public venues or onsite at your location.
Review: What is Spring?
• Spring is a framework with many modules
– To simplify many different Java EE tasks
• Core module: dependency injection
– Lets you define an XML file that specifies which beans
you define an XML file thatspecifies which beans
are created and what their properties are
• Simplifies OOP by promoting loose coupling between
classes Also called Inversion of Control (IoC)
classes. Also called “Inversion of Control” (IoC)
– This is the module that we will use with JSF
• This tutorial assumes you are already familiar with Spring
dependency injection in desktop Java apps
dependency injection in desktopJava apps
• Many other modules
– AOP, security, JDBC templates, etc.
7
• Although most of these are not contradictory to the use of
JSF, dependency injection is by far the most sought-after
Spring feature for JSF apps
You are Using JSF Already:
Why Use Spring?
Why Use Spring?
• Issue
– JSF already supports dependency injection via the
managed-property element of faces-config.xml• So why use Spring to do what JSF already does?
why use Spring to do what JSF already does?
• Reasons
– You might already have beans set up with Spring from
other applications
• And you would like to use them without adding new code
– Spring is more powerful
is more powerful
• Spring supports more and better dependency injection
features than does faces-config.xml.
• But, beforeintroducing Spring, make sure your JSF app
before introducing Spring make sure your JSF app
will significantly benefit from these features
8
You are Using Spring Already:
Why Use New Approach?
Why Use New Approach?
• Issue
– Normal Spring already supports ways to access beans.
• So why add a new way for JSF?
• Reasons
– You need to access bean definitions from many places
• With...
Regístrate para leer el documento completo.