File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Spring and the fly likes JSF/PrimeFaces with Spring Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "JSF/PrimeFaces with Spring" Watch "JSF/PrimeFaces with Spring" New topic
Author

JSF/PrimeFaces with Spring

Jehan Jaleel
Ranch Hand

Joined: Apr 30, 2002
Posts: 196
Hi,

I have a simple web app implemented with JSF/PrimeFaces. I have a dataTable for which I need to get some data..



adviceInquiry is the name of my bean which I am expecting to provide data. I defined a simple pojo and used annotations to tell that it is a component like below..



When I try to load my page, it gives the following error...



So it seems that the adviceInquiry bean is either not recognized or has been instantiated. Do I need to add it to my applicationContext file or something to make this happen?

Thanks for any help.
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17256
    
    6

You have to integrate JSF with Spring

Here is that documentation.
http://static.springsource.org/spring/docs/3.0.x/spring-framework-reference/html/web-integration.html#jsf

Once that is done, then you can use your Spring beans as backing beans on JSF pages.

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Jehan Jaleel
Ranch Hand

Joined: Apr 30, 2002
Posts: 196
Hi Mark,

Thanks for taking the time to respond.

I do have the EL Resolver in my faces config file...

<application>
<el-resolver>org.springframework.web.jsf.el.SpringBeanFacesELResolver</el-resolver>
</application>

Do I need to do anything more than this? Becuz it still gives the same error.

Thanks again.
Jehan Jaleel
Ranch Hand

Joined: Apr 30, 2002
Posts: 196
I figured it out, I had to activate component scanning for Spring.

When I inserted this line into my applicationContext.xml it works...

<context:component-scan base-package="com.wu.settlement" />
Jehan Jaleel
Ranch Hand

Joined: Apr 30, 2002
Posts: 196
Just a follow up question on this, I would just like to know what are the advantages of using PrimeFaces/JSF with Spring. After all JSF provides its own container and MVC like front end framework, so why use Spring at all?

Thanks.
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17256
    
    6

Jehan Jaleel wrote:Just a follow up question on this, I would just like to know what are the advantages of using PrimeFaces/JSF with Spring. After all JSF provides its own container and MVC like front end framework, so why use Spring at all?

Thanks.


Spring Framework is an application framework not a web framework. JSF is a web framework. Spring MVC is Spring's Web container.

Spring framework goes way beyond just a web framework. It can be used for any application.

JSF also has many issues. Some of us think the 6 phases are complete overkill and makes JSF complicated to get working correct.

Mark
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSF/PrimeFaces with Spring