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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T02:50:09+00:00 2026-06-10T02:50:09+00:00

JSF custom composite components input.xhtml <cc:interface> <cc:attribute name=validator/> </cc:interface> <cc:implementation> <h:inputText validator=#{cc.attrs.validator}/> </cc:implementation> *.xhtml

  • 0

JSF custom composite components
input.xhtml

<cc:interface>
    <cc:attribute name="validator"/>
</cc:interface>

<cc:implementation>
    <h:inputText validator="#{cc.attrs.validator}"/>
</cc:implementation>

*.xhtml

<l:input value = ... validator="#{testValidator.validator}"/>

java code

@ManagedBean

public class TestValidator {

    public void validator(FacesContext context, UIComponent component, Object value) throws ValidatorException {
         System.out.println("Call validator");
    }
}

PropertyNotFoundException:

validator="#{testValidator.validator}": The class 'TestValidator' does not have the property 'validator'.

How to solve this problem?
my final way:

  • 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-06-10T02:50:10+00:00Added an answer on June 10, 2026 at 2:50 am

    This is indeed not going to work. In order to attach a validator to an input component specified by the composite, you need to register the input component as a <cc:editableValueHolder> in the <cc:interface> first.

    <cc:interface>
        <cc:editableValueHolder name="yourInputName" targets="yourInputId" />
    </cc:interface>
    <cc:implementation>
        <h:inputText id="yourInputId" ... />
    </cc:implementation>
    

    This way, any <f:validator for="yourInputName"> nested in the composite component declaration will be applied to the desired input component.

    <l:input>
        <f:validator validatorId="myValidator" for="yourInputName" />
    </l:input>
    

    You’ll only need to replace the tight coupled validator method by a real standalone Validator implementation.

    @FacesValidator("myValidator")
    public class MyValidator implements Validator {
        // ...
    }
    

    Note: the standard JSF validators like <f:validateLength>, <f:validateRequired>, etc have all also a for attribute for this purpose.

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

Sidebar

Related Questions

I know of two ways of creating custom JSF components: 1. Native JSF way:
I'm writing custom JSF 2.0 components. Is there way to step through each of
I need to create a custom Component with JSF 2.0 (not composite component), that
I am using JSF custom validator to fetch an error message from proper resource
I am learning about composite components with JSF 2.0 and i want my component
We have a custom JSF component that renders some buttons and a select box
I'm writting a custom JSF component that will render image transitions for a set
I am using JSF and have made a custom servlet for loading images dynamically.
Is it possible to call another JSF component from within a custom component (as
In JSF's tag, if you feed it using a Map<Key, Value> <h:selectOneMenu value=#{bean.integerProperty}> <f:selectItems

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.