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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T05:17:44+00:00 2026-06-14T05:17:44+00:00

for example: when I click on the button A . I get the following

  • 0

for example: when I click on the button A. I get the following text : you have choosed A.

But when I change button, I get the same text, although the value of #{bean.str} changes

Here is my code :

<p:selectOneButton id="selectId" value="#{bean.str}">
            <f:selectItem itemLabel="A" itemValue="1" />
            <f:selectItem itemLabel="B" itemValue="2" />
            <f:selectItem itemLabel="C" itemValue="3" />
            <f:ajax event="change" render="tabView" listener="#{bean.change}" />
</p:selectOneButton>

<c:if var="test" test="#{bean.str =='1'}">
        <h:outputText value="you have choosed A" />
</c:if>
<c:if test="#{beanApplication.perspective=='2'}">
        <h:outputText value="you have choosed B" />
</c:if>
<c:if test="#{beanApplication.perspective=='3'}">
        <h:outputText value="you have choosed C" />
</c:if>

I am looking for a way to refresh the JSTL <c:if> test when I click on the button.

  • 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-14T05:17:45+00:00Added an answer on June 14, 2026 at 5:17 am

    JSTL runs during JSF view build time, not during JSF view render time. However, the submitted value is in this particular example only set as bean property after view build time. The view build time runs during JSF RESTORE_VIEW phase, but the bean property is set during JSF UPDATE_MODEL_VALUES phase.

    You need to evaluate the condition during render time instead. Use the therefor provided JSF component’s rendered attribute.

    <h:outputText value="you have chosen A" rendered="#{bean.str == '1'}" />
    <h:outputText value="you have chosen B" rendered="#{bean.str == '2'}" />
    <h:outputText value="you have chosen C" rendered="#{bean.str == '3'}" />
    

    Further, you should be using <p:ajax> in PrimeFaces components, not <f:ajax>. Also you should ensure that the component referenced as tabView in <f:ajax render> (and equivalently, the <p:ajax update>) covers the above three components. Here’s a complete kickoff example:

    <p:selectOneButton id="selectId" value="#{bean.str}">
        <f:selectItem itemLabel="A" itemValue="1" />
        <f:selectItem itemLabel="B" itemValue="2" />
        <f:selectItem itemLabel="C" itemValue="3" />
        <p:ajax listener="#{bean.change}" update="tabView" />
    </p:selectOneButton>
    
    <h:panelGroup id="tabView">
        <h:outputText value="you have chosen A" rendered="#{bean.str == '1'}" />
        <h:outputText value="you have chosen B" rendered="#{bean.str == '2'}" />
        <h:outputText value="you have chosen C" rendered="#{bean.str == '3'}" />
    </h:panelGroup>
    

    See also:

    • JSTL in JSF2 Facelets… makes sense?
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Lets say for example: $(.button).click(function() { $.post(commandrunner.php, { param1: 'value', param2: 'value2', param3: 'value3'
Take the example I have setup at http://jsfiddle.net/vEF6y/ Click on the 'add item' button
In the following example, how can I get: the button to be disabled-grey the
I have managed to get my click event working with the following code. When
about click and submit example below: <form action=url method=post> <input type=text id=input1/> <input type=submit
I'm trying to solve the following problem: I have a download button that when
Ok, Here's the exampe: <table> <tr> <td> <type=button id=mybutton value=insert> </td> <td> <textarea>My Text</textarea>
I have the following (example) of my xml document: <Students> <Student ID = *GUID
I have the following example where when a user clicks a navigation line it
The following example displays a modal dialog box when the user clicks the button.

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.