• 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 ...
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
  • Piet Souris
  • Himai Minh

facelets and CDI

Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I don't understand the classpath requirements for facelets and CDI on glassfish. I'm using Netbeans, and have the following:

when I look at javaee-api it has javax.enterprise.context.ApplicationScoped and javax.inject.Named which are the particular imports being used in the bean. The facelets part is working, the template navigates correctly. It deploys to Glassfish and runs, except...there's no output from the @Named bean:

from the page:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<html xmlns="http://www.w3.org/1999/xhtml"

This and everything before will be ignored
<ui:composition template="template.xhtml">
<ui:define name="navigation">
<ui:include src="menu.xhtml"/>
<ui:define name="main">
next #{nextClient.next}
This and everything after will be ignored

Everything I read says to use CDI, that it's preferable now. I'm using EL, or more specifically, UEL, correctly, I believe. I'm largely following Facelets Essentials:


and am just trying to get the template client to invoke NextClient.getNext() with the EL of nextClient.next, but nothing happens...there's no stacktrace or error in glassfish:

the page displays as:

well, now I'm baffled. Now it's working. I can't figure what I did for the life of me...that's the desired output, each time the page is accessed the counter increments.

Now it works. Is this on the right track? Way off base? I have an entity class from a database which I'd like to link up to this, and output the class.

I can inject the entity into NextClient? I'm trying to do the "R" for Read in a CRUD application with CDI and facelets (using templates).

I've found much reference material on EJB, but it seems a mishmash. I just want to use CDI. What am I doing right/wrong, or, besides the PDF from Oracle on Java EE 7, what are good CDI reference material's? Much of what's on the web is woefully out of date, or not applicable to using CDI.
Posts: 4109
Hibernate Fedora Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

... It deploys to Glassfish and runs, except...there's no output from the @Named bean: ...

If you meant just starting up the server where the app is deployed then you will not see any output unless you are printing to the console at the startup. You would need to access for example a page in order to see an output.

CDI is the way JEE environment used to inject & manage dependencies. If you packaged them properly they should be available to be accessed from within the in the application.
Sunglasses. AKA Coolness prosthetic. This tiny ad doesn't need shades:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
    Bookmark Topic Watch Topic
  • New Topic