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

  • Home
  • SEARCH
  • 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 4087966
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T18:55:19+00:00 2026-05-20T18:55:19+00:00

I have the code bellow: <c:set var=show value=#{cartBean.itemsAdded} /> <c:if test=${show}> <h:form id=test1> <h:commandLink

  • 0

I have the code bellow:

<c:set var="show" value="#{cartBean.itemsAdded}" />

<c:if test="${show}">
    <h:form id="test1">
        <h:commandLink action="#{cartBean.foo}">this doesn't work</h:commandLink>           
    </h:form>
</c:if>

<h:form id="test2">
    <h:commandLink action="#{cartBean.foo}">this works!</h:commandLink>         
</h:form>

When show=false, show only the second link.
And it works. I can reach server (I’m using debug to see this).

When show=true, both links appears. But ONLY second link works. The link inside conditional doesn’t trigger the action in server.

Someone, can, please, help me?

Note: the same thing happens when I use a4j:outputPanel rendered=”#{show}”

  • 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-20T18:55:19+00:00Added an answer on May 20, 2026 at 6:55 pm

    During processing of the form submit, JSF will re-evaluate whether the command button/link is been rendered. If it is not rendered, then it will simply skip the action.

    You need to ensure that the expression #{cartBean.itemsAdded} returns true as well when the form submit is been processed by JSF. An easy test is to put the bean in the session scope (and I assume that the isItemsAdded() is a pure getter, i.e. it contains only return itemsAdded;).

    If that did fix the problem and you’d like to keep the bean in the request scope, then add a <a4j:keepAlive> to retain the bean properties in the subsequent request.

    <a4j:keepAlive beanName="#{cartBean}" />
    

    See also:

    • Commandlink is not being invoked

    Unrelated to the concrete problem, you should prefer JSF tags/attributes over JSTL ones as much as possible. In this particular case, you should get rid of both JSTL <c:> tags and use the JSF-provided rendered attribute instead:

    <h:form id="test1" rendered="#{cartBean.itemsAdded}">
        <h:commandLink action="#{cartBean.foo}">this doesn't work</h:commandLink>           
    </h:form>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i have done some code in jquery but where i commented in this bellow
I have code below: <select id=testSelect> <option value=1>One</option> <option value=2>Two</option> </select> <asp:Button ID=btnTest runat=server
I have code as below: var s : String = hello world var xml
I have the code below in my test code in many places: // //
for example have a div,html code below <div id=testDiv></div> but when i set the
I have a form which I am using to update an existing set of
In Class1 I have a var named cDte1. I would like to set it
I have the code below where it validates the form. How do i make
I have the code below, I'm attempting to write a generic function which takes
I have the code below that is supposed to draw lines from the top

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.