Hi Craig,
   
  I could not receive the email from [email protected], but I saw your 
response on shale user mail-archive.
   
  Why I need to add an instance of VC as request attribute? That is good 
question~{!-~}
   
   
  In our web application, we have 10 VC that extends TestVC, and TestVC extends 
AbstractViewController.  There is a header.jsp that is included in all pages. 
In this header.jsp, we need to use the information of TestVC to decide the 
navigation rule among pages. So we add an instance of TestVC as request 
attribute, and access it in header.jsp.  we don't specify a TestVC bean in 
faces-config.xml file.
   
  We will find a way to solve the problem since this is not a bug in the 
lastest version of shale framework.
   
  Many thanks,
   
   Luo
   


 

 

Craig McClanahan
Sat, 23 Sep 2006 00:00:50 -0700

On 9/22/06, emily chen <[EMAIL PROTECTED]> wrote:  

Hi there,      I think there is a bug in Shale framework 1.0.4-SNAPSHOT(  
shale-framework-20060917.zip). in the init() function of TestVC that  extends 
AbstractViewController, if we get the HTTPServeltRequest object from  
ExternalContext, then try to add a new attribute ( an instance of TestVC) to  
the request object. The TestVC is created, then destroyed, recreated,  
destroyed, recreated, destroyed.....  

  Just out of curiousity, why are you adding an instance of TestVC as a  
request attribute, when it is already there (because its a managed bean and  
JSF created it for you)?    The reason this is relevant is that the underlying 
mechanism that fires  ViewController lifecycle events is now a 
ServletRequestAttributeListener  (was not the case in 1.0.1, but there were 
many other bugs the way it used  to be handled).  That means the callback 
methods are fired as soon as a  request attribute is added.  If you add  this 
same instance under some other  key, the callback methods will be fired again.  
If you re-add it under the  same key the previous registered instance will be 
destroyed, then the new  instance (happens to be the same bean) init'd again -- 
exactly as you are  seeing.    Craig  



                
---------------------------------
Stay in the know. Pulse on the new Yahoo.com.  Check it out. 

Reply via email to