Immediate=true means that your validations and events occur in the
applyValues phase.
I don't have time to research it, but I think executing an action
skips to the renderResponse phase on completion, so the
processValidations and updateModel phases are effectively skipped.  
If you used an actionListener instead, then the action is still
executed before update model phase, but updateModel and
processValidation phases might still be executed.

For #2, I don't remember when actionListeners are executed, but one
quick thing to try would be to use action instead of actionListener
and see if it makes any difference.   It seems to me that what you've
posted in your second scenario should work, though.


On 9/6/05, javaone9 <[EMAIL PROTECTED]> wrote:
> I am confused with JSF life cycle.  some senarios: 
>   
> Senario 1 -- Cancel 
>  
> <h:form> 
> ... 
> 
> <h:commandLink id="cancel" action="Cancel" 
> 
> value="#{bundle.Cancel}" immediate="true"> 
> 
> </h:form> 
> 
> When the Cancel link is clicked, will "Update Model data" phase be skipped
> so the model data will not be changed? 
> 
> (note that immediate = true) 
> 
> The Sun's JSF doc(j2ee1.4 tutorial) says: 
> 
> If some components on the page have their immediate attributes (see The
> immediate Attribute, page 701) set to true, then the validation, conversion,
> and events associated with these components will be processed during this
> phase. 
> 
> It does not say the "Update Model date" phase will be skipped. However the
> model data did not get changed.(MyFaces example: Edit All Countries). 
> 
> Senario 2 -- ActionEvent of commandLink 
> 
> <h:form> 
> 
> <x:dataTable id="data" 
> 
> var="city" 
> 
> value="#{backingBean.cityList}" 
> 
> preserveDataModel="true" 
> 
> rows="10" 
> 
> > 
> 
> ... 
> 
> <h:column> 
> 
> <h:selectBooleanCheckbox value="#{city.selected}" 
> 
> </h:column> 
> 
> // some <h:inputText> here 
> 
>  
> 
> <h:column> 
> 
> <h:commandLink actionListener="#{backingBean.change}" value="Change" /> 
> 
> </h:column> 
> 
> </x:dataTable> 
> 
> <h:commandButton action="#{backingBean.submit}" value="Submit"/> 
> 
> </h:form> 
> 
> ------- 
> 
> BackingBean change() method: 
> 
>   public void change(ActionEvent e) throws NamingException { 
> 
>     UIComponent comp = e.getComponent();
>         HtmlDataTable dataTable = (HtmlDataTable)
> comp.getParent().getParent();
>     City city = (City)dataTable.getRowData();
>     
>     sessionBean.mergeCity(city);
>    
>   } 
> 
> My questions are: 
>  
> ActionListener is invoked before "update model data" phase. does
> sessionBean.mergeCity(city) include new changes from pages?  but it works. 
> Check all checkboxes, and then submit  the form. Inside the submit() method,
> going through the cityList, the "selected" attribute of all the cities are
> false. I expect them to true. what is going wrong? 
> 
> Please help. Thank you. Have a nice day! Dave
> 
>  ________________________________
>  Click here to donate to the Hurricane Katrina relief effort. 
> 
>

Reply via email to