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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T15:39:27+00:00 2026-05-14T15:39:27+00:00

I know of two ways of creating custom JSF components: 1. Native JSF way:

  • 0

I know of two ways of creating custom JSF components:
1. Native JSF way: creating JSF component class, tag, etc.
2. Facelets way: defining component in a xhtml file and then creating appropriate decrption in facelets taglib.

Currently I work on a project in which introducing facelets is unfortunately out of the question. On the other hand, creating custom components the standard JSF way seems like a pain in the ass.

Is there maybe a third party library that allows creating custom components in the way similar to facelets but doesn’t entail the need of using non-standard renderer?

  • 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-14T15:39:27+00:00Added an answer on May 14, 2026 at 3:39 pm

    You can do a limited amount of templating using (for example) jsp:include and f:subview.

    Alternatively, you can extend a UIComponent overriding selected methods and then provide it via an existing tag and a managed bean using the binding attribute. This still requires a reasonably detailed understanding of component development (and the consequences of this choice), but could cut down the number of files/volume of code significantly.

    This approach is a bit of a hack, but might be OK for short-term stuff. You wouldn’t do it for component libraries you want to distribute or components requiring long term maintenance.

    The new component:

    public class QuickComponent extends HtmlOutputText {
      @Override public void encodeAll(FacesContext context) throws IOException {
        ResponseWriter writer = context.getResponseWriter();
        writer.writeText("I'm not really a HtmlOutputText", null);
        for (UIComponent kid : getChildren()) {
          if (kid instanceof UIParameter) {
            UIParameter param = (UIParameter) kid;
            writer.startElement("br", this);
            writer.endElement("br");
            writer.writeText(param.getName() + "=" + param.getValue(), null);
          }
        }
      }
    }
    

    The bean providing an instance:

    /**Request-scope managed bean defined in faces-config.xml*/
    public class QuickComponentProviderBean {
      private QuickComponent quick;
    
      public void setQuick(QuickComponent quick) {
        this.quick = quick;
      }
    
      public QuickComponent getQuick() {
        if (quick == null) {
          quick = new QuickComponent();
        }
        return quick;
      }
    }
    

    Note: don’t reuse a single bean property for multiple tags in your views, or they’ll reference the same object instance.

    Adding the new component to the view:

    <h:outputText binding="#{quickComponentProviderBean.quick}">
      <f:param name="Hello" value="World" />
    </h:outputText>
    

    Note: the attributes that can be defined have not changed. They’re fixed by the TLD.

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

Sidebar

Related Questions

I know two ways to set the timeout interval of a session: way 1:
I know two ways to check parameters of the method and throw exceptions when
I know there are two ways, [self.navigationController pushViewController:siteViewController animated:YES]; [self presentModalViewController:anotherViewController animated:YES]; However, those
Ok , I know the two standard ways to create a new thread and
I know that we can initialise an array in one of two ways: Loop
As far as I can tell, there are two main ways of creating functions
I am a little confused in declaring variable in android, I know two ways
There are two ways that I know that you can fetch results in Rails
Below is the two ways I know how tomcat keep session as so far.
There are at least two ways that I know of to write a Symbian

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.