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

The Archive Base Latest Questions

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

If I had a managed bean as follows: @ManagedBean @RequestSchoped public class Example {

  • 0

If I had a managed bean as follows:

@ManagedBean
@RequestSchoped
public class Example {

    private List<String> stringList;
    private List<Long> longList;

    // getters, setters, etc. down here
}

and had a custom component which accepted a List as an attribute:

<?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:cc="http://java.sun.com/jsf/composite"
      xmlns:h="http://java.sun.com/jsf/html">

  <!-- INTERFACE -->
  <cc:interface>
      <cc:attribute name="aList" type="java.util.List" />
  </cc:interface>

  <cc:implementation>
      <!-- code is in here -->
  </cc:implementation>
</html>

How could I make sure that this worked:

<myComp:previousComponent aList="#{example.stringList}" />

but this didn’t:

<myComp:previousComponent aList="#{example.longList}" />

In other words, what I want to do for the cc:attribute is as follows:

<cc:attribute name="aList" type="java.util.List<java.lang.String>" />

However, as we know xhtml doesn’t take kindly to using > or <. Also, with Generics only being checked at compile time, I’m not sure how this would be done. Does anyone know if this is possible?

  • 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-16T06:01:29+00:00Added an answer on May 16, 2026 at 6:01 am

    You could check the type of each item using #{item.class.name}. The Class#getName() returns a String denoting the type. E.g. java.lang.String or java.lang.Long. You could make use of it in the rendered attribute.

    Add an extra attribute denoting the full qualified classname.

    <my:comp list="#{bean.list}" type="java.lang.String" />
    

    in combination with

    <cc:attribute name="list" type="java.util.List" required="true" />
    <cc:attribute name="type" type="java.util.String" required="true" />
    

    and this logic in cc:implementation:

    <ul>
        <ui:repeat value="#{cc.attrs.list}" var="item">
            <h:panelGroup rendered="#{item.class.name == cc.attrs.type}">
                <li>#{item}</li>
            </h:panelGroup>
        </ui:repeat>
    </ul>    
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I had the following JSF backing bean in my Webapp @ManagedBean class MyBackingBean implements
I had integrated in app billing within my project in order to sell managed
I am trying to validate a list of object on Struts2. Suppose you had
I had Managed SMTP server configurations in IIS to send email through asp as
I've just upgraded to NetBeans 7.1 from 7.0. On opening a JSF managed bean
I read Jeff's blog post that someone had managed to see a closed source
I've had a couple of complaints that one of our managed apps is using
In native programming the IXMLDOMDocument2 object had a tranformNode() method: public BSTR transformNode(IXMLDOMNode stylesheet);
I thought I finally had managed to write my first init.d script properly but
I managed my original problem i had to add the break; but now 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.