>From: "Dan Diodati" [EMAIL PROTECTED] > >Thanks for the reply, but I'm still not sure if this is correct. > >My component is correctly implementing the save and restore methods(I do see >these methods being >invoked by jsf). Although if I set some new values on the component within the >renderer's decode method, >the values do not get saved out to the component and later restored when the >encodeBegin >is invoked. So the state of the component is not the same. > >I thought the purpose of the decode method is to obtain request values that >need to set local values on a >component(section 8.2 the spec). > >If this is not correct, then how could you deal with this situtation? >
Humm, it sounds like the view is being recreated after the invoke application phase instead of restored. Are you using a "action" + "outcome" navigation for the command that submitted the page? If the navigation handler finds a matching navigation rule for the command, it will recreate the view versus just restoring it. This would cause you to loose the components state captured in the apply request values phase and saved after the render response phase. >Dan Gary From: Gary VanMatre [mailto:[EMAIL PROTECTED] Sent: Tuesday, January 16, 2007 7:50 PM To: MyFaces Development Subject: Re: BUG: Ui component instance different for renderer decode and encode methods? >From: "Dan Diodati" [EMAIL PROTECTED] >I was creating a custom jsf component to use and I noticed that the component >instance that is passed to the renderer decode method is different than the >one passed to the encodeBegin,encodeEnd. > >This seems to be a bug since I want to be able to set some values taken from >outside params onto the component within the decode and later in the >encodeBegin access the component with the updated values. > >Currently the component loses the values set on it due to the component >instance being different when the encodeBegin is called. > >Is this a bug in the myfaces implementation? > This is not a bug. It's just the way that JSF works. You most might need to implement these methods in your component. public Object saveState(FacesContext context) public void restoreState(FacesContext context, Object state) Section 2.5.3.1 - State Management Considerations for the Custom Component Author in the JSF 1.1 spec talks about this issue. You might also take a look at some of the other components out there: http://svn.apache.org/viewvc/myfaces/core/trunk/api/src/main/java/javax/faces/component/UIInput.java?view=markup >Dan Gary
