• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Getting started with JSF : JSF and Spring

 
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Jesper De Jong,

In your book can I find  some examples about how to configure an App that needs to have JSF and Spring. I know this something crazy, but I have a customer who is requesting this, because in the view layer my customer wants to have Primefaces + JSF, however for the backside they need Spring + Hibernate, so it would be great if in your book you wirte about how mix two big frameworks like JSF with another.

Regards
 
Marshal
Posts: 8856
637
Mac OS X VI Editor BSD Java
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Just a quick clarification, it isn't a book. It is a video series.
 
Rafael Morales
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok, thank you for the correction
 
Saloon Keeper
Posts: 27752
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Incidentally, the quick answer to that question is that there's a JSF-Spring bridge that you can configure into the faces-config. It allows Spring beans to be referenced in EL exactly like JSF beans are and can be used to inject persistence interface services into Managed Beans. As well as other Spring services, such as email, scheduling, and so forth.

My typical large JSF/Spring/Hibernate-JPA app has a persistence service layer that deals with sets of related data and is transactional. This allows me to keep all the persistence Model objects detached while working in JSF code and in the View Rendering phase (which I personally recommend). The persistence service layer basically deals with data as business functions.

Below the persistence layer, I have a DAO layer. The JSF code never talks to anything in here directly, only via the persistence service layer (in extreme cases, that will make a persistence service class a mere proxy for the DAO, but such is life). The DAOs are Spring-injected into the persistence services that need them. The DAOs are the CRUD/Finder code for individual tables (or sometimes parent/child table sets), whereas the persistence services handle heterogeneous groups of tables (a "working set"). Like the persistence services, the DAOs are transactional, and they will inherit transaction context, so if a persistence transaction invokes DAO functions, all the DAO functions will commit or rollback when the persistence service does.

That's all it takes.
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can indeed configure Spring's expression language resolver in faces-config.xml so that you can use Spring dependency injection instead of CDI (the Java EE standard API for dependency injection). In the project I'm currently working on, we are doing just that. It looks approximately like this in faces-config.xml:

 
Rafael Morales
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you for your answer!!! It works now
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic