aspose file tools*
The moose likes JSF and the fly likes New to JSF : Interaction between JSF and EJB's Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "New to JSF : Interaction between JSF and EJB Watch "New to JSF : Interaction between JSF and EJB New topic
Author

New to JSF : Interaction between JSF and EJB's

Arjun Marayil
Greenhorn

Joined: Mar 01, 2006
Posts: 6
Hi,

I am new to JSF.

I am writing a small program for User Management. I have an entity bean and database table for user. I have also written a session bean "UserManager". This session bean has methods for create/modify and delete user operations.

my question is:

If I use JSF, I need to use a java bean and set the values from the JSF to this java bean, then call the EJB from a method in this java bean. Right?
How will I do the mapping from java beans to Entity beans?

Please help.

Thanks.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16019
    
  20

In theory, you could use an EJB directly as a JSF backing bean, but in practice it's not very realistic. You do better to let an ordinary backing bean be the go-between.

An industrial-grade application would put the display interaction in the backing bean, optionally have it invoke a business-layer bean for app-specific business logic, have that bean invoke a DAO or data service bean (which could be a session EJB), and it would manage the storage and retrieval of entity EJBs. Which may seem a bit much, but in major apps, having a few well-defined layers of simple functions beats lumping things together in one big ugly do-everything object.

I use the JPA and the Spring framework for my persistence-layer functionality and it works quite well for me.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: New to JSF : Interaction between JSF and EJB's