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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T08:38:20+00:00 2026-05-20T08:38:20+00:00

I am thinking of making a hidable/showable menu on my web application. Before this,

  • 0

I am thinking of making a hidable/showable menu on my web application. Before this, I used PHP and AJAX extensively for this purpose. However, since HTML element id is regenerated in JSF framework I found out that this method is no longer feasible at least in my scope.

I have read f:ajax tag in JSF and tried to implement it. Apparently no luck for me. It looks so easy but I still could not find out what I did wrong.

I have prepared a prototype to test the f-ajax tag functionality but no luck. Here is the code

   ` <h:body>
     <h:outputLabel>
        <h:outputText value="Click A" />
        <f:ajax event="click" render="textA"/>
    </h:outputLabel>
    <h:outputLabel>
        <h:outputText value="Click B" />
        <f:ajax event="click" render="textB"/>
    </h:outputLabel>
    <h:outputLabel>
        <h:outputText value="Click C" />
        <f:ajax event="click" render="textC"/>
    </h:outputLabel>

    <h:outputText id="textA" value="Click A" />
    <h:outputText id="textB" value="Click B" />
    <h:outputText id="textC" value="Click C" />
    </h:body>`

When I clicked the particular label, nothing happend. The textA, textB and textC elements are already rendered in the first place. What did I do wrong guys?

Thanks in advance.

  • 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-20T08:38:21+00:00Added an answer on May 20, 2026 at 8:38 am

    However, since HTML element id is regenerated in JSF framework

    If that is so important, just specify fixed ids yourself. Each component has an id attribute for that. This way you should be able to use normal JS/jQuery frameworks whenever applicable.

    As to the problem in the concrete question, here’s a working example which should get you started.

    <h:form>
        <f:ajax render="text">
            <h:commandLink value="Click A" action="#{bean.setShow('A')}" /><br/>
            <h:commandLink value="Click B" action="#{bean.setShow('B')}" /><br/>
            <h:commandLink value="Click C" action="#{bean.setShow('C')}" /><br/>
        </f:ajax>
    
        <h:panelGroup id="text">
            <h:outputText value="Clicked A" rendered="#{bean.show == 'A'}" />
            <h:outputText value="Clicked B" rendered="#{bean.show == 'B'}" />
            <h:outputText value="Clicked C" rendered="#{bean.show == 'C'}" />
        </h:panelGroup>
    </h:form>
    

    in combination with

    @ManagedBean
    @ViewScoped
    public class Bean {
    
        private String show;
    
        public String getShow() {
            return show;
        }
    
        public void setShow(String show) {
            this.show = show;
        }
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am thinking of making an (initially) small Web Application, which would eventually have
I'm thinking about making a simple web application to practice custom tags, EL, ...
I have an ASP.NET web application that I am making and I am thinking
I'm working on administrative application. I was thinking about making it fully AJAX-ed. Basically,
I'm thinking about making an app that gets data from a website. However this
I'm thinking of making an application where at some points a graph is displayed
I was thinking of making a commercial application to sell to customers to install
Possible Duplicate: PHP take all combinations I'm thinking of making something in PHP that
I'm thinking of making a web service that can file bugs on issue trackers
I'm thinking about making an application that makes audio in a Java application. 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.