File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes JSF and the fly likes PhaseListener  problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "PhaseListener  problem " Watch "PhaseListener  problem " New topic

PhaseListener problem

Dushyant Agarwal
Ranch Hand

Joined: Oct 14, 2007
Posts: 75
I have developed an application in JSF where the JSF page's Backing bean extends an AbstractBB class. AbstractBB is an abstract class that implements PhaseListener.

The beforePhase() and afterPhase() methods call the callback methods beforeRenderResponse() and afterRenderResponse() respectively.

Also I have a listener class that implements ServletRequestAttributeListener.
This class implements attributeAdded() method that calls an fireInit() method. This class is registered as the listener in the web.xml.

The fireInit() method registers the AbstractBB instance on the default lifecycle instance as the phase listener(the backing bean extending the AbstractBB gets registered as phase listener), and calls the init() method on the AbstractBB class.

The init() method is implemented in the backing bean. It gets called after the constructor of the backing bean gets called and before the apply request values phase.

But if I try to access the components inside the backing bean, it seems to be not possible. Although I don't get any error I am not able to get the component instance. If I create a new instance of the component even then I am not able to set values on the component( though if I try to set the value of a component like this inside the constructor then it is possible).

What should be done to solve this problem?? I need to set values inside the init() method on the component..
I agree. Here's the link:
subject: PhaseListener problem
jQuery in Action, 3rd edition