• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

CDI bean is not working for chapter 2's first example

 
Bartender
Posts: 2418
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, I am reading chapter 2 of Core JSF 3rd edition,
I found an issue that the @Named CDI bean does not work with my GlassFish 4.1:

The index.xhtml accessing the FaceServlet is:


I noticed that the quizBean.answer always return "" no matter what I input. Please see the attached image for the index.xhtml.

But when I modify into this:


Everything works. The quizBean can get the answer and navigate to the next quiz question.
It seems like the   does not navigate to the next page when @Named CDI bean is used.
indexPage.JPG
[Thumbnail for indexPage.JPG]
index.xhtml when @Named CDI bean is used
 
Greenhorn
Posts: 17
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Does this blast to the past help?

https://coderanch.com/t/513343/java/ManagedBean-works-Named-doesn
 
Himai Minh
Bartender
Posts: 2418
13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the link.

I tried this example with CDI bean:


I downloaded cdi-api.jar and add it to the classpath of the project. Now, it works with CDI bean.

 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic