This week's book giveaway is in the OCAJP 8 forum.
We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line!
See this thread for details.
The moose likes JSF and the fly likes NPE when using setFor() Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "NPE when using setFor()" Watch "NPE when using setFor()" New topic

NPE when using setFor()

Dudley Dawson
Ranch Hand

Joined: Dec 14, 2004
Posts: 57
I am building an HtmlPanelGrid dynamically (by binding the h:panelgrid tag to a backing bean method that builds it with the api), and I am having a problem whenever I try to call setFor(String id) on a HtmlMessage or HtmlOutputLabel. When the page renders, I get the following exception:

However, if I view the component tree, these elements exist, and indeed do have their "for" attribute set exactly as i specified. The page will render if I don't attempt to set the "for" property, but then, these components are orphaned and rather useless ;)
I agree. Here's the link:
subject: NPE when using setFor()
jQuery in Action, 3rd edition