Thanks Simon for that link it did the trick.  Maybe I should go take a
second look at that wiki, last I looked the documentation was pretty
sparse though.

I also tried putting a literal string for the action attribute and that
did not work.

Thanks again!
-John

-----Original Message-----
From: Simon Kitching [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, January 04, 2006 7:44 PM
To: MyFaces Discussion
Subject: Re: update other component values via an immediate action


Using "immediate" effectively *does* skip validation *if* the 
component's action or actionListener calls renderResponse, because the 
lifecycle then leaps directly from apply-request-values to 
render-response without passing through the "validate" phase. It *also* 
leaps over the "update model" phase of course.

Specifying a literal string for the "action" attribute of a command 
component implicitly causes renderResponse to be called, which is often 
how such components are used.

Regards,

Simon

Dennis Byrne wrote:
> Actually, the immediate attribute does not actually skip validation.
See this wiki page for a deeper explanation.
> 
> http://wiki.apache.org/myfaces/How_The_Immediate_Attribute_Works
> 
> 
>> -----Original Message-----
>> From: John Holland [mailto:[EMAIL PROTECTED]
>> Sent: Wednesday, January 4, 2006 05:22 PM
>> To: 'MyFaces Discussion'
>> Subject: update other component values via an immediate action
>>
>> Is it possible to update component values using an immediate action
(no
>> validation)?
>>
>>
>>
>> Here's the situation, I have a list of shifts that a user may select
>> from. When they select a shift and hit the load button it updates the
>> rest of the model with that shifts data.  The button is immediate
>> because I don't want any of the other data to be validated yet.  The
>> load button's code is below.
>>
>>
>>
>> <h:commandButton type="submit"
>>
>>                 value="#{msgs.loadButton}"
>>
>>                 immediate="true"
>>
>>     actionListener="#{onCallAssignmentBackerBean.loadShift}"
>>
>>                 styleClass="button"/> 
>>
>>
>>
>>
>>
>> The problem is that the new values don't seem to get displayed in the
>> resulting page the old ones are redisplayed instead.  Here's the
>> actionListener code I use to update my backing bean.
>>
>>
>>
>>    /**
>>
>>     * An immediate action, so I need to manually set the new shift.
>>
>>     */
>>
>>            public void loadShift(ActionEvent event) {
>>
>>                        FacesContext context =
>> FacesContext.getCurrentInstance();
>>
>>                        UIViewRoot viewRoot = context.getViewRoot();
>>
>>                        
>>
>>                        UIInput shiftComponent = (UIInput)
>> viewRoot.findComponent("mainForm:selectShiftBox");
>>
>>                        
>>
>>                        if(null != shiftComponent.getSubmittedValue())
{
>>
>>
>>                                   try {
>>
>>                                               setSelectedShiftId(new
>> Long((String) shiftComponent.getSubmittedValue()));
>>
>>                                   } catch (ClassCastException e) {
>>
>>                                               //swallow it up...
mmmm.
>> We don't want this error bubbling to the top.
>>
>>                                   }
>>
>>                        }
>>
>>                        
>>
>>            if(selectedShiftId != null) {
>>
>>                        
>>
>>                        ShiftBean shift =
>> onCallServices.getShift(selectedShiftId);
>>
>>                        
>>
>>                        setEndTime(shift.getEndDate());
>>
>>                        setStartTime(shift.getStartDate());
>>
>>                        setPriority(shift.getPriority());
>>
>>                        setRemark(shift.getRemark());
>>
>>                        
>>
>>            }
>>
>>    }
>>
>> All of the other components values are drawn from this backing bean
>>
>>
>>
>> The updates to the backing bean happen correctly and if you do a
manual
>> refresh of the page the new values appear.   
>>
>>
>>
>> It seems to me that the getters aren't being called for the other
>> components when the load button is activated.
>>
>>
>>
>> Anybody have any idea what I'm doing wrong here?  Am I using the
>> immediate attribute correctly?
>>
>>
>>
>> Thanks,
>>
>> John
>>
>>
>>
>>
> 
> 
> 
> 

Reply via email to