2

If I work with JSF (version 1.2. or 2.0), I can manage JavaBean classes, which hold the methods and which are called or used by the JSF pages.

I can work with the faces-config.xml or with @ManagedBean annotation. Every way of solution has the problem, that I must refer concrete classes. In that way I build a hard reference on a specific class.

Exists a way of solution in JSF, to refer interfaces or abstract classes in faces-config.xml or with @ManagedBean annotation, which are implemented by a javabean. I mean the following: I won't refer concrete classes, I will refer a way of abstraction to give my application a way of possibility, to change or to grow with a suitable degree of maintenance.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
  • You can check this link: http://www.mkyong.com/jsf2/jsf-2-0-spring-integration-example/ http://www.mkyong.com/jsf2/jsf-2-0-spring-hibernate-integration-example/ – Rounak Aug 22 '13 at 13:36
  • 1
    JSF Boss has answered you... you will not get more detailed then this great BalusC – Fahim Parkar Aug 22 '13 at 14:45
  • First of all, take a look on BalusC anwser. Second, if you really want to change your controllers, what's the problem with using interfaces or abstract classes (don't like it) and choose the concrete implementation in the faces-config.xml? That's exactly the reason why some guys choose this approach instead of the @ManagedBean annotation. – kalamar Aug 22 '13 at 15:21

1 Answers1

6

I don't see how that ever forms a problem. A JSF backing bean is as being a controller tied to a specific view anyway. Perhaps you're tight coupling JSF backing beans with business service and/or database interaction code? In that case, you should decouple business service and database interaction code from the JSF backing bean classes and refactor them into fullworthy and reusable business service facade classes following the service locator pattern, using a business service framework such as EJB or Spring.

This absolutely can't and shouldn't be solved at JSF side. You seem to have missed the whole point of JSF in that perspective. JSF is merely a MVC framework for form based web applications, not a business service framework.

See also:

Community
  • 1
  • 1
BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555