myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Myfaces Wiki] Update of "ClearInputComponents" by JeffBischoff
Date Fri, 26 Jan 2007 15:40:16 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Myfaces Wiki" for change notification.

The following page has been changed by JeffBischoff:
http://wiki.apache.org/myfaces/ClearInputComponents

The comment on the change is:
immediate=false was described in paragraph 2 - now we describe immediate=true!

------------------------------------------------------------------------------
  
  Note that because data is being pushed into the model, the validation phase must run, and
therefore any invalid data in the page will cause the action to be skipped, and the page is
redisplayed with the validation errors displayed. This is not generally the desired behaviour
for a "clear" type operation! The solution is to set attribute immediate=true on the command
so that its associated action is invoked before validation is applied to the input components
in the same view (see ["How_The_Immediate_Attribute_Works"]).
  
- However when using command components with immediate=false, things become more complex.
All components will retrieve the raw submitted values submitted by the user, but the immediate
command will then run before they can be pushed into the backing beans; the components therefore
remember this data. When the (immediate) action causes navigation to another view then this
is no problem; these components will be discarded anyway. However if the action method causes
JSF to go directly to the render phase 'of the same view' [by calling facesContext.renderResponse()],
then the components will behave as they do for a validation failure - by displaying the value
cached in the component rather than fetching data from the backing bean.
+ However when using command components with immediate=true, things become more complex. All
components will retrieve the raw submitted values submitted by the user, but the immediate
command will then run before they can be pushed into the backing beans; the components therefore
remember this data. When the (immediate) action causes navigation to another view then this
is no problem; these components will be discarded anyway. However if the action method causes
JSF to go directly to the render phase 'of the same view' [by calling facesContext.renderResponse()],
then the components will behave as they do for a validation failure - by displaying the value
cached in the component rather than fetching data from the backing bean.
  
  Below are a number of possible solutions.
  

Mime
View raw message