wood burning stoves 2.0
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
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

New to JSF : Interaction between JSF and EJB's

Arjun Marayil

Joined: Mar 01, 2006
Posts: 6

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.

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17410

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.

An IDE is no substitute for an Intelligent Developer.
I agree. Here's the link: http://aspose.com/file-tools
subject: New to JSF : Interaction between JSF and EJB's
It's not a secret anymore!