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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T08:43:50+00:00 2026-05-29T08:43:50+00:00

I have the following code in JSF-2 Mojarra 2.0.8 running on Tomcat 7 <h:panelGrid

  • 0

I have the following code in JSF-2 Mojarra 2.0.8 running on Tomcat 7

<h:panelGrid  id="yesNoRadioGrid">
<h:panelGrid columns="2" rendered="#{user.yesNoRadioGridFlag}">
    <h:outputText id ="otherLbl" value="Select Yes or No"></h:outputText>
    <h:selectOneRadio id="yesNoRadio" value ="#{user.yesNoRadio}">
        <f:selectItems value="#{user.choices}"/>                    
        <f:ajax execute="@form" render="userDetailsGrid "></f:ajax>
    </h:selectOneRadio>
</h:panelGrid>
</h:panelGrid>      
<h:message for ="yesNoRadio"> </h:message>
<h:panelGrid  id="userDetailsGrid">
<h:panelGrid columns="2" rendered="#{user.yesNoRadio}">
    <h:outputLabel>Name :</h:outputLabel>
    <h:inputText id="customerName" value="#{user.customerName}"></h:inputText>
    <h:outputLabel>Salary: </h:outputLabel>
    <h:inputText id="customerSalary" value="#{user.customerSalary}"></h:inputText>
</h:panelGrid>
</h:panelGrid>

My managedBean contain following

private enum Choice {

    Yes, No; 
    } 
private Choice yesNoRadio;
public Choice[] getChoices() {
    return Choice.values(); 
    }
public Choice getYesNoRadio() {
    return yesNoRadio;
}
public void setYesNoRadio(Choice yesNoRadio) {
    this.yesNoRadio = yesNoRadio;
}

How can I render my ‘userDetailsGrid’ based on the boolean value (user.yesNoRadio) selected in

I found a workarround by adding following in my mangedbean

private Boolean yesNoRadio;
public SelectItem[] getMyBooleanValues() {   
    return new SelectItem[] {    
    new SelectItem(Boolean.TRUE, "Yes"),   
    new SelectItem(Boolean.FALSE, "No")    
    };   
}  

and changing my view to

<h:selectOneRadio id="yesNoRadio" value ="#{user.yesNoRadio}">
    <f:selectItems value="#{user.myBooleanValues}" />                   
    <f:ajax execute="@form" render="userDetailsGrid "></f:ajax>
</h:selectOneRadio>
  • 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-29T08:43:50+00:00Added an answer on May 29, 2026 at 8:43 am

    You can also just check the enum value in the rendered attribute. Enums are evaluated as strings in EL, so you can do a simple string comparison. This way you can keep your original code.

    <h:panelGrid columns="2" rendered="#{user.yesNoRadio == 'Yes'}">
    

    By the way, you perhaps really want to use execute="@this" instead of execute="@form" (or just remove it altogether, it defaults to @this already). The execute="@form" will process the entire form and thus also fire validation there where you perhaps don’t want.

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

Sidebar

Related Questions

I have following code for updating user's column public void UpdateLastModifiedDate(string username) { using
I'm using Glassfish 3.1.1 and JSF 2.0: I have the following code: public String
I have the following code: JSF Managed Bean: @ManagedBean(name = purchaseView) @ViewScoped public class
I have the following JSF code (stripped down for the sake of sanity): <!DOCTYPE
I have the following code inside a method invoked by a jsf <h:commandButton>. It
I have the following exception at the time of running JSF program. org.apache.jasper.JasperException: An
I have this new problem. I have the following code in JSF 2.0 with
I have follow following code in my JSF application <t:dataList id=slider-one value=#{MyBean.banners} var=ofr layout=simple
I just inherited a project implemented in JSF. I have the following code which
I have following code in initialization im = imread('Image02.tif'); figure(); imagesc(im); colormap(gray); [hImage hfig

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.