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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T09:20:48+00:00 2026-06-10T09:20:48+00:00

Does JSF 2.0 have a built-in method for finding the client ID of another

  • 0

Does JSF 2.0 have a built-in method for finding the client ID of another component? There are about a thousand client ID-related questions on SO and there are a lot of hackish methods to do this, but I’m wondering if JSF 2.0 brought a simpler method that I just don’t know.

#{component.clientId} evaluates to a given component’s own client ID, but I want to reference another component’s ID.

This blog post mentions component.clientId, and it also says #{someComponent.clientId} works, but from what I can tell it does not. I believe he wrote that before any reference implementations of JSF 2.0 were out, so he was just going by the JSR and maybe that functionality changed. I’m not sure.

I know PrimeFaces and RichFaces both have their own functions to return a client ID, but I’m just wondering if there’s a built-in JSF 2.0 method for this. Here are some examples:

This works to return the outputText’s ID.

`<h:outputText value="My client ID : #{component.clientId}" />`

According to the blog post above, this should work, but it does not. I just get no output.

`<h:button id="sampleButton" value="Sample" />`

`<h:outputText value="sampleButton's client ID : #{sampleButton.clientId}" />`

This works in PrimeFaces:

`<h:outputText value="PrimeFaces : sampleButton's client ID : #{p:component('sampleButton')}" />` 

Works in RichFaces:

`<h:outputText value="RichFaces : sampleButton's client ID : #{rich:clientId('sampleButton')}" />`

Also, if at all possible I’m looking for solutions that won’t break if I change the javax.faces.SEPARATOR_CHAR value or if I add/remove containers outside the referenced components. I’ve spent plenty of time tracking down issues caused by hard-coded ID paths.

  • 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-10T09:20:49+00:00Added an answer on June 10, 2026 at 9:20 am

    You need to assign the component a variable name in the view scope by binding attribute.

    <h:button id="sampleButton" binding="#{sampleButton}" value="Sample" />
    <h:outputText value="sampleButton's client ID : #{sampleButton.clientId}" />
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Does anyone have the URL to the Mojara JSF 2 components API. I seem
I have a JSF page (using MyFaces 2.0) that does a bit of data
I have a JSF-managed session-scopped bean. It is also a spring component so that
I have a form in JSF 2.0 with a lot of text (labels) and
I have a basic question about JSF and their ManagedBeans. Imagine we have set
so I have been tasked with finding out whether an existing JSF project can
Does Tomahawk for JSF 2.0 works for JSF 2.1 / MyFaces Core 2.1 ?
In JSF 2 (SUN RI ) UI:repeat does not increment the id of table
I'm using JSF templates and Primefaces. Javascript code does not seem to be working
Does anyone know if there is a way to generate different code in 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.