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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T04:33:14+00:00 2026-05-31T04:33:14+00:00

I am facing an issue Empty id attribute is not allowed in JSF while

  • 0

I am facing an issue “Empty id attribute is not allowed in JSF” while using the below mentioned composite component for a group of buttons (button’s count can be 1 to 3) (I use Mojarra 2-0-8 on Tomcat-7) .

    <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:composite="http://java.sun.com/jsf/composite">


    <composite:interface>       
        <composite:attribute name="buttonCount" />
        <composite:attribute name="button1Id" />
        <composite:attribute name="button1Style" />
        <composite:attribute name="button1Action" />
        <composite:attribute name="button2Id" />
        <composite:attribute name="button2Style" />
        <composite:attribute name="button2Action" />
        <composite:attribute name="button3Id" />
        <composite:attribute name="button3Style" />
        <composite:attribute name="button3Action" />

    </composite:interface>
    <composite:implementation>       
        <h:commandButton  rendered = "#{cc.attrs.buttonCount ge '1'}" id="#{cc.attrs.button1Id}" styleClass="#{cc.attrs.button1Style}">
            <f:ajax listener="#{cc.attrs.button1Action}" immediate="true"/>                                     
        </h:commandButton>
        <h:panelGroup rendered = "#{cc.attrs.buttonCount ge '2'}">
            <h:commandButton  id="#{cc.attrs.button2Id}" styleClass="#{cc.attrs.button2Style}">
                <f:ajax listener="#{cc.attrs.button2Action}" immediate="true"/>                                     
            </h:commandButton>
        </h:panelGroup> 
        <h:panelGroup rendered = "#{cc.attrs.buttonCount eq '3'}">
            <h:commandButton  id="#{cc.attrs.button3Id}" styleClass="#{cc.attrs.button3Style}">
                <f:ajax listener="#{cc.attrs.button3Action}" immediate="true"/>                                     
            </h:commandButton>
        </h:panelGroup> 
    </composite:implementation>
</html>

Use of the above CC.

<Buttons:myButton txtHeader="Title" txtDescription="text1"
                    txtAction="TextAction." button1Style="btnSave" buttonCount ="1" button1Id="btnSaveConf" button1Action="#{MyBean.save()}"></Buttons:myButton>

is there any better way to dynamically generate buttons based on a count or any simillar input form the main page.
note:- id, styles and action should differ in name.

  • 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-31T04:33:16+00:00Added an answer on May 31, 2026 at 4:33 am

    You can’t use render time EL in id attribute. Give it a fixed ID instead and give the composite itself also an ID. Thus, for example:

    <buttons:myButton id="foo" ... />
    

    with in the implementation

    <h:commandButton id="button1" ... />
    <h:commandButton id="button2" ... />
    <h:commandButton id="button3" ... />
    

    They will then become foo:button1, foo:button2 and foo:button3 where the foo part is thus controllable in the template client.

    If you really need dynamic IDs for some unobvious reason, then you should rather create a tag file, not a composite component.

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

Sidebar

Related Questions

I am using Appweb server (mini http server) and facing an issue while opening
I have been facing issue with sphinx result set for string attribute. Below is
i am doing a database design using EAV. I am facing an issue when
I am using ASP.NET MVC2 with NHibernate, but am facing an issue. All calls
I am facing issue with proper date retrieval using date formatter.I have saved the
Im facing an issue which I believe to be VAO-dependant, but Im not sure..
I am facing an issue in automating a web application using selenium web driver.
I’m currently facing an issue that my Oracle knowledge cannot solve, I’m definitely not
I'm facing a issue with opening mail client using openURL. Here is the code.
I am facing issue while loaidng the data in JQGrid at a later stage

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.