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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T02:32:32+00:00 2026-06-16T02:32:32+00:00

I have a HashMap in the backing bean and I want to dynamically render

  • 0

I have a HashMap in the backing bean and I want to dynamically render multiple select box. Here is the code:

    <h:selectManyCheckbox
      id="id"
      value="#{backingBean.value}"
      layout="pageDirection"
      styleClass="label"
      required="true"
      requiredMessage="You must select at least...">


      <a4j:repeat var="aGroup" items="#{backingBean.map}">

        <f:selectItem id="role#{aGroup.value.property1}" itemLabel="#{aGroup.value.property1}" itemValue="#{aGroup.value.property2}" />

        <rich:tooltip for="role" value="#{aGroup.value.property5}" />

     </a4j:repeat>

    </h:selectManyCheckbox> 

It is not rendering.
Using the f:selectItems tag, it is rendering, but I need to manually create the f:selecteItem as I have to attach a rich:tooltip with each f:selectItem.

Any ideas ?

Ravi

  • 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-16T02:32:33+00:00Added an answer on June 16, 2026 at 2:32 am

    Use <c:forEach> instead of <a4j:repeat>.

    First add this namespace at the top of your page.

    xmlns:c="http://java.sun.com/jstl/core"
    

    Now replace <a4j:repeat..... with this.

    <c:forEach var="aGroup" items="#{backingBean.map}">
    

    EDIT:


    I don’t think that <rich:toolTip> can be applied to <f:selectItem>. As a weird hack you can do something like this.

    This is your managed-bean which returns the list or a map. Here I’m using a map because it seems you are using a map.

    public class MyBean {
      private Map<Integer, String> map;
    
      public Map<Integer, String> getMap() {
        map = new HashMap<Integer, String>();
        map.put(1, "Tool tip 1");
        map.put(2, "Tool tip 2");
        map.put(3, "Tool tip 3");
        return map;
      }
    }
    

    Now your xhtml code would be like this. Here I’m rendering selectItems dynamically. However this is not necessary for this to work.

    <h:form id="myForm">
        <h:selectManyCheckbox id="myChkBox" layout="pageDirection" styleClass="label" required="true" requiredMessage="You must select at least...">
            <c:forEach var="aGroup" items="#{myBean.map}">
                <f:selectItem itemValue="someValue1" itemLabel="someValue1" id="someId#{aGroup.key}" /> 
                <span class="rich-tool-tip" id="span#{aGroup.key}" style="z-index: 99; visibility: visible; display: none;">
                    <span>#{aGroup.value}</span>
                </span>
                <script>
                    var i = !i ? 0 : i;
                    new ToolTip("span#{aGroup.key}","myForm:myChkBox:" + i,{'showEvent':'mouseover'} );
                    i++;
                </script>
            </c:forEach>
        </h:selectManyCheckbox>
        <rich:toolTip rendered="false"/>
    </h:form>
    

    That is it…
    Note the <rich:toolTip> which is set as rendered="false". This is required. Otherwise some important JS parts are not imported and your toolTip will not work.

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

Sidebar

Related Questions

Here's the code that I have: HashMap<String, String> inst1 = new HashMap(instructorIO.getInstructors()); instListModel =
I have a hashmap which I want to copy for other use. But whenever
I have a HashMap where the key is a word and the value is
I have a hashmap with some information(key and value) in a perl file. I
I have a hashmap that contains multiple string arrays. I am trying to output
I have a hashmap as below: 1->x 2->y 3->x 4->z Now i want to
I have hashmap and its keys are like folder/1.txt,folder/2.txt,folder/3.txt and value has these text
I have a hashmap and I am inserting an arraylist as the value in
I have a HashMap object that contains key=>value set which are both integers. F
I have HashMap object contains a key x-y-z with corresponding value test-test1-test2 . Map<String,String>

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.