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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T14:40:07+00:00 2026-05-14T14:40:07+00:00

How to attach a rich:tooltip to the list generated by f:selectItems when using a

  • 0

How to attach a rich:tooltip to the list generated by f:selectItems when using a variable for the attribute for inside the rich:tooltip.

This code works fine (the value of #{prefix} is theprefixvalue

<ui:composition>
<a4j:form id="#{prefix}_form">
<h:selectOneRadio style="text-align:left" id="#{prefix}_rating">
<f:selectItems value="#{test.options}"></f:selectItems>
</h:selectOneRadio>&nbsp; 
<rich:toolTip for="theprefixvalue_form\:theprefixvalue_rating\:0">a</rich:toolTip>      
</a4j:form>
</ui:composition>

But this code does not:

<ui:composition>
<h:outputText value="#{prefix}" />
<a4j:form id="#{prefix}_form">
<h:selectOneRadio style="text-align:left" id="#{prefix}_rating">
<f:selectItems value="#{test.options}"></f:selectItems>
</h:selectOneRadio>&nbsp; 
<rich:toolTip for="#{prefix}_form\:#{prefix}_rating\:0">a</rich:toolTip>        
</a4j:form>
</ui:composition>

Throws the following exception:

Caused by: java.lang.IllegalArgumentException: theprefixvalue_rating
    at javax.faces.component.UIComponentBase.findComponent(UIComponentBase.java:612)
    at org.ajax4jsf.renderkit.RendererUtils.findComponentFor(RendererUtils.java:1037)
    at org.richfaces.renderkit.html.ToolTipRenderer.getTargetId(ToolTipRenderer.java:234)
    at org.richfaces.renderkit.html.ToolTipRenderer.constructJSVariable(ToolTipRenderer.java:251)
...

TestBean is session scoped and this is the code for getOptions();

public List<SelectItem> getOptions(){
    List<SelectItem> options = new ArrayList<SelectItem>();
    options.add(new SelectItem("a","a"));
    options.add(new SelectItem("b","b"));
    options.add(new SelectItem("c","c"));
    return options;

}

Any ideas? The goal is to have a tooltip when the mouse is over the different options. Thanks in advance.

Edit: Apparently HtmlSelectOneRadio is not implementing NamingContainer, so it fails at UIComponentBase line 611:
(result is an instance of HtmlSelectOneRadio, length>0 and segments[1] = "theprefixvalue_rating")

        if (result != null && (!(result instanceof NamingContainer)) && length > 0) {
            throw new IllegalArgumentException(segments[i]);

I am trying to use my own NamedHtmlSelectOneRadio which extends HtmlSelectOneRadio and implements NamingContainer but I’m still guessing how to inject it with facelets. Any idea?

  • 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-14T14:40:07+00:00Added an answer on May 14, 2026 at 2:40 pm

    Finally I managed to solve it.

    I created my own component called NamedHtmlSelectOneRadio which is just a wrapper of HtmlSelectOneRadio but implements NamingContainer. I don’t know if this will have further implications through the rest of JSF code, but my testcase works fine. Anyway, I’ll update this answer if I find any strange behavior, as well as I’ll post in the Mojarra implementation of JSF regarding why HtmlSelectOneRadio does not implements NamingContainer out-of-the-box.

    Here are the steps to create your own component with facelets.

    1 Wrap the class:

    import javax.faces.component.NamingContainer;
    import javax.faces.component.html.HtmlSelectOneRadio;

    public class NamedHtmlSelectOneRadio extends HtmlSelectOneRadio implements NamingContainer {
    
        public NamedHtmlSelectOneRadio(){
            super();
        }
    
    }
    

    2 Wrap the Tag class and set the above class as component Type:

    import com.sun.faces.taglib.html_basic.SelectOneRadioTag;
    
    public class NamedHtmlSelectOneRadioTag extends SelectOneRadioTag {
    
        public NamedHtmlSelectOneRadioTag(){
            super();
        }
        @Override
        public String getComponentType() {
            return "javax.faces.NamedHtmlSelectOneRadio";
        }
    
    }
    

    3 Add the component to your faces-config.xml configuration:

    <component>
    <component-type> com.eyeprevent.util.NamedHtmlSelectOneRadio </component-type>
    <component-class> com.eyeprevent.util.NamedHtmlSelectOneRadio </component-class>
    </component>
    

    4 Add the tag to your taglib (mine is functions.taglib.xml). More info about creating your own taglib here

    <tag>
    <tag-name>namedSelectOneRadio</tag-name>
    <component>
    <component-type>com.eyeprevent.util.NamedHtmlSelectOneRadio</component-type>
    </component>
    </tag>`
    

    5 Include the new taglib in your .xhtml (or .jsf) page and replace the h:selectOneRadio with your own (mine is fnc:namedSelectOneRadio)

    xmlns:fnc="http://eyeprevent.com/fnc"
    ...
    
    <fnc:namedSelectOneRadio id="#{prefix}_rating">
    <f:selectItems value="#{test.options}"></f:selectItems>
    </fnc:namedSelectOneRadio>
    <rich:toolTip for="#{prefix}_form\:#{prefix}_rating:0">a</rich:toolTip>
    

    And that’s all!

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

Sidebar

Ask A Question

Stats

  • Questions 404k
  • Answers 404k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer Qt uses the moc compiler to produce its meta-object system… May 15, 2026 at 5:33 am
  • Editorial Team
    Editorial Team added an answer No, you will require 8 separate statements as case and… May 15, 2026 at 5:33 am
  • Editorial Team
    Editorial Team added an answer This is where it gets a bit trial and error,… May 15, 2026 at 5:33 am

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.