Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7981321
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T10:20:01+00:00 2026-06-04T10:20:01+00:00

In my JSF 2 based application I have a form that includes (amongst other

  • 0

In my JSF 2 based application I have a form that includes (amongst other UI components) some checkboxes.

On the checkboxes I have registered ajax requests that fire when they are checked. The ajax requests will actually just update the value of another checkbox in the backing bean.
As a result the other checkbox will also be checked (when it gets re-rendered – as it will take the updated value from the backing bean in the render response phase).

This works fine until the whole form gets submitted and validation errors occur.
Then the ajax requests still work and change the value on the backing bean but in the phase of re-rendering the updated checkbox the value for it is not taken from the backing bean but from a cached value that is taken from a ComponentStateHelper class.

As far as I understand this is used for the new feature of JSF 2 to only store partial changes to the component tree.

What I do not understand is: How is this related to the validation phase? Why is there a cached value in the StateHelperclass for my checkbox when the validation found errors?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T10:20:04+00:00Added an answer on June 4, 2026 at 10:20 am

    This is a known problem and explained in depth in this answer. In a nutshell, the problem is caused because the invalidated components which are to be rendered by <f:ajax render> but are not been executed by <f:ajax execute> remains in an invalidated state along with the original submitted value. When JSF renders the input component, JSF will first check if the submitted value is not null and then display it, else it will display the model value. You basically need to reset the submitted value of input components which are to be rendered, but which are not been executed by ajax.

    To achieve this, you can use an ActionListener which basically does the following:

    UIViewRoot viewRoot = context.getViewRoot();
    PartialViewContext partialViewContext = facesContext.getPartialViewContext();
    Set<EditableValueHolder> inputs = new HashSet<EditableValueHolder>();
    
    // First find all to be rendered inputs and add them to the set.
    findAndAddEditableValueHolders(partialViewContext.getRenderIds(), inputs);
    
    // Then find all executed inputs and remove them from the set.
    findAndRemoveEditableValueHolders(partialViewContext.getExecuteIds(), inputs);
    
    // The set now contains inputs which are to be rendered, but which are not been executed. Reset them.
    for (EditableValueHolder input : inputs) {
        input.resetValue();
    }
    

    This has been reported as JSF issue 1060 and a complete and reuseable solution has been implemented in the OmniFaces library as ResetInputAjaxActionListener (source code here and showcase demo here).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

How to improve performance of jsf myfaces based application ? Some tips that I
I have configured a form based log in in my JSF 2.0 Application on
I have a JSF application that uses mostly Richfaces. I would like to introduce
I have a J2EE/JSF-based web-app. It consists of an form-input, a text display and
I have a small JSF application where the user is required to enter some
In my application I have created some locking / unlocking functionality based on the
We have a web based java/JSF/Spring application for which we want to create sitempas.xml
I have developed an JSF and richfaces based application, Here I want to know
I am developing a web application based on JSF technology. I use Eclipse as
I have a JSF web client and a Java client that both use the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.