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 3350498
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T01:47:39+00:00 2026-05-18T01:47:39+00:00

JSF view code: <f:view> <h:form> <h:panelGrid> <h:inputText id=key value=#{myManagedBean.key}/> <h:selectBooleanCheckbox id=rerun value=#{myManagedBean.rerun} rendered=#{myManagedBean.displayRerun}/> <h:commandButton

  • 0

JSF view code:

<f:view>
    <h:form>
        <h:panelGrid>
            <h:inputText id="key" value="#{myManagedBean.key}"/>
            <h:selectBooleanCheckbox id="rerun" value="#{myManagedBean.rerun}" rendered="#{myManagedBean.displayRerun}"/>
            <h:commandButton id="check" action="#{myManagedBean.check}"/>
        </h:panelGrid>
    </h:form>
<f:view>

JSF model code:

public class MyManagedBean {

    private boolean displayRerun;


    public void setDisplayRerun(boolean aDisplayRerun) {
       this.displayRerun = aDisplayRerun        }

    public boolean getDisplayRerun() {
       return this.displayRerun;
    }

   private String key;


    public void setKey(String aKey) {
       this.key = aKey
    }

    public String getKey() {
       return this.key;
    }
    private boolean rerun;


    public void setRerun(boolean arerun) {
       this.rerun = arerun
    }

    public boolean getRerun() {
       return this.rerun;
    }

    public String check() {
        //do data validation
        setDisplayRerun(true);
        System.out.println(getRerun());
    }

}

This always prints false regardless of whether the checkbox is checked or not.

Additional Information on my requirement:

Nick/BalusC, my managed bean is of request scope. It is indeed simplified code snippet that I presented. My page has couple of user input controls along with a command button. On submit of command button, I call action method of backing bean, in which I do data validation (in this case I lookup database and see if the inputs are already registered.) If already registered, I come back to the same page, this is when I display the singleBooleanCheckBox for the user to select and hit the command button again.
I am toggling the display of the checkbox based on a managedbean property (a boolean flag set during data validation).

When I re-submit the page with checkbox checked, I do not receive this data.

For further verification, I replace the selectBooleanCheckbox, with a command button with similar behavior (basically do not render it initially, but only show it on data validation). I mapped its @action to my managedbean’s action method. To my surprise, when I hit the button, the action method is not executed. Instead, the page is refreshed like in a “immediate” scenario or a redirect.

I have been struggling on this for almost 6 hrs. Appreciate your experienced insights.

Thanks.

  • 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-05-18T01:47:40+00:00Added an answer on May 18, 2026 at 1:47 am

    So, you’ve actually a rendered attribute on the checkbox (that was not present in your initial question) and the bean is request scoped (it would have worked when it was session scoped). The submitted checkbox value will not be gathered during apply request values phase when this attribtue evaluates false at that point.

    You basically need to retain the condition responsible for the rendered attribute in the subsequent request as well. This can be done in several ways: putting bean in session scope, using Tomahawk’s t:saveState or h:inputHidden with a bean binding. Each is outlined in detail in this answer.

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

Sidebar

Related Questions

I can generate datatable during form initialization.(JSF). Then I want to write javascript for
In my JSF 1.2 webapp I have a page with a <h:commandButton> that invokes
I am just starting with this, and with this code: public static void main(String[]
Today I'd like to know some features on the JSF Lifecycle. Let me start
HI, I want to know how to implement Validator in JSF. What is the
I've found some questions that seem related to this one, but none describes exaclty
i am using facelets,richfaces,and ajax, in XHTML i am facing error while creating datepicker!
I have the following navigation rules defined in faces-config.xml. I am able to navigate
As the complexity of the web projects that I am working on increases, 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.