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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T06:50:01+00:00 2026-05-24T06:50:01+00:00

I have this composite component: <cc:interface> <cc:attribute name=image_1 /> <cc:attribute name=image_2 /> <cc:attribute name=image_3

  • 0

I have this composite component:

<cc:interface>
    <cc:attribute name="image_1" />
    <cc:attribute name="image_2" />
    <cc:attribute name="image_3" />
</cc:interface>

<cc:implementation>
    <div id="slider-container">
        <div id="slider-small">
            <h:graphicImage library="images" name="#{cc.attrs.image_1}" />
            <h:graphicImage library="images" name="#{cc.attrs.image_2}" />
            <h:graphicImage library="images" name="#{cc.attrs.image_3}" />
        </div>
    </div>
</cc:implementation>

I use it in this way :

<cs:small_slider 
    image_1="about/1.jpg"
    image_2="about/2.jpg"
    image_3="about/3.jpg"
/>

but is limited to three attributes. What should I do if I have to send more than three, using the same composite component, like this:

<cs:small_slider 
    image_1="about/1.jpg"
    image_2="about/2.jpg"
    image_3="about/3.jpg"
    image_4="about/4.jpg"
    image_5="about/5.jpg"
/>

I want to do this to reuse the component and I don’t want to create another.

UPDATE:
Follow @BalusC approach renders the follow HTML:

<!-- small slider --> 
<div id="slider-container"> 
    <div id="slider-small">
        <img src="/brainset/javax.faces.resource/1.jpg.xhtml?ln=images" />
        <img src="RES_NOT_FOUND" />
        <img src="RES_NOT_FOUND" /> 
    </div> 
    <div id="frame-slider-small"></div> 
</div><!-- end #slide-container --> 

It not found the others images, only the first. I’m sure those images: ‘about/2.jpg’ and ‘about/3.jpg’ exist.

  • 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-24T06:50:02+00:00Added an answer on May 24, 2026 at 6:50 am

    That’s not possible and it also violates the DRY principle.

    Your best bet is to either pass it as a List<String> from the bean instead so that you can iterate over it using <ui:repeat>:

    <cs:small_slider images="#{bean.images}" />
    

    with

    <cc:interface>
        <cc:attribute name="images" type="java.util.List" required="true" />
    </cc:interface>
    
    <cc:implementation>
        <div id="slider-container">
            <div id="slider-small">
                <ui:repeat value="#{cc.attrs.images}" var="image">
                    <h:graphicImage library="images" name="#{image}" />
                </ui:repeat>
            </div>
        </div>
    </cc:implementation>
    

    Or define it as a hardcoded comma-separated string instead and use JSTL fn:split() to split them into a String[] which you in turn feed to <ui:repeat>:

    <cs:small_slider images="about/1.jpg,about/2.jpg,about/3.jpg" />
    

    with

    <cc:interface>
        <cc:attribute name="images" type="java.lang.String" required="true" />
    </cc:interface>
    
    <cc:implementation>
        <div id="slider-container">
            <div id="slider-small">
                <ui:repeat value="#{fn:split(cc.attrs.images, ',')}" var="image">
                    <h:graphicImage library="images" name="#{image}" />
                </ui:repeat>
            </div>
        </div>
    </cc:implementation>
    

    Unrelated to the concrete problem, try to be consistent with Java/JSF naming conventions. I’d rename your small_slider.xhtml to renameSlider.xhtml so that you can use it as <cs:smallSlider>, which is nicely in line with all normal JSF components.

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

Sidebar

Related Questions

I have a composite component: <composite:interface> <composite:attribute name=actionMethod method-signature=java.lang.String action() required=true /> </composite:interface> <composite:implementation>
This relates to Composite Application Guidance for WPF, or Prism. I have one MainRegion
I have a composite control which emits HTML that looks like this <span id=myControl>
We have a composite primary key for the site table defined below. Functionally, this
I have a composite component (collapsiblePanel). The component uses the collapsible bean to provide
I have a JSF 2 composite component that employs some Ajax behavior. I want
I have the following Java Server Faces 2.0 composite component. Notice i am using
A pretty normal case: We have a 'portlet' composite component that has two states:
I'm trying to extend a LinearLayout to use as a composite component. I have
I have created a composite component in JSF2. I works great. I would like

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.