Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSF/PrimeFaces with Spring

 
Jehan Jaleel
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Jehan Jaleel
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 196
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 196
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic