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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T03:14:13+00:00 2026-05-18T03:14:13+00:00

Edited question… Hello, I would like to load a .xhtml file of my composite

  • 0

Edited question…

Hello,

I would like to load a .xhtml file of my composite component from a backing bean, and add it to the page dynamically. The name of the .xhtml file comes form a variable.

Ex.:

public MyBean (){

    String componentFile = "myCompositeComponent.xhtml"

    public String addComponentToPage(){

          //how do that?...

          return null;
    }

} 

Thank you!

  • 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-18T03:14:14+00:00Added an answer on May 18, 2026 at 3:14 am

    That’s not possible. A composite component is template-based and can only be used in views. Your best bet is to repeat exactly the JSF code which you’ve originally written in the composite component in the model. Better would be to create a full worthy @FacesComponent class which extends UIComponent, complete with a @FacesRenderer. True, it’s a tedious and opaque job, but this way you’ll end up with a component which is reuseable in both the view and the model by a single code line.

    An -ugly- alternative is to place all possible components in the view and use the rendered attribute.

    <my:component1 rendered="#{bean.myComponentType == 'component1'}" />
    <my:component2 rendered="#{bean.myComponentType == 'component2'}" />
    <my:component3 rendered="#{bean.myComponentType == 'component3'}" />
    ...
    

    Wrap this if necessary in a Facelets tag file so that it can be hidden away and reused in several places.

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

Sidebar

Related Questions

Edited 3.9.2011 to add one more related question Hello, I'm very new to WCF
I have HTML code edited by FCKEditor stored in a database and would like
How do I load the edited .emacs file without restarting Emacs?
I'd like to write a plugin that does something with the currently edited file
Edited:: Hi All, I have a XML file like this, <message> <c1> <rrcConnectionSetupComplete> <rrc-TransactionIdentifier>2</rrc-TransactionIdentifier>
Users can be edited from a normal resourceful URI like: /users/1/edit The issue is
I edited the question after David Hanak's answer (thanks btw!). He helped with the
Here is an example of polymorphism from http://www.cplusplus.com/doc/tutorial/polymorphism.html (edited for readability): // abstract base
I've always just FTPed files down from sites, edited them and put them back
Edited Question: This should be clear. using System; namespace UpdateDateTimeFields { class Program {

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.