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

This is my jsf code :- <h:commandButton id=cmdLogin value=Login actionListener=#{indexBean.login}> <f:ajax execute=@form render=@all />
In JSF's tag, if you feed it using a Map<Key, Value> <h:selectOneMenu value=#{bean.integerProperty}> <f:selectItems
I have the following code in JSF-2 Mojarra 2.0.8 running on Tomcat 7 <h:panelGrid
I've got a dropdown on my index.xhtml JSF front page. The associated code/commandButton looks
I use JSF 1.2. I have a view in which I have a h:commandButton
i've got this jsf code <f:view> <rich:page pageTitle=My Page markupType=xhtml> ... <rich:panel id=content> <a4j:include
Consider the following jsf page: <h:body> <h:form id=SessionStartDialog> <table> <tr> <td class=label> <h:outputLabel value=Enter
i am trying to include a java code into the value of the inputText
Is the JSF 2.0 View Scope back button safe? e.g. if I store a
I read somewhere the view ids used by JSF framework have a happy side

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.