• Post Reply Bookmark Topic Watch Topic
  • New Topic

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

 
Himai Minh
Ranch Hand
Posts: 1563
10
  • Mark post as helpful
  • send pies
  • 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
 
Mike Roundtree
Greenhorn
Posts: 16
1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does this blast to the past help?

https://coderanch.com/t/513343/java/ManagedBean-works-Named-doesn
 
Himai Minh
Ranch Hand
Posts: 1563
10
  • Mark post as helpful
  • send pies
  • 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.

  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!