• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

JSF/PrimeFaces with Spring

 
Ranch Hand
Posts: 196
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic