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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T05:29:43+00:00 2026-05-26T05:29:43+00:00

I have a problem with a JSF composite which validates internal input fields. Following

  • 0

I have a problem with a JSF composite which validates internal input fields.
Following code snippet works as long as only one composite is included.

<div id="#{cc.clientId}" >
  <h:panelGroup styleClass="#{not firstname.valid ? 'fmError' : ''}">
    <div class="col220">
        <h:outputLabel for="firstname" value="Vorname(n):" />
    </div>
    <div class="col220">
        <h:inputText id="firstname" styleClass="fmTxt " 
            value="#{cc.attrs.person.firstname}" binding="#{firstname}">
            <f:validateRequired />
        </h:inputText>

    </div>
  </h:panelGroup>
</div>

As you can see I use the cc.clientId to wrap the composite and having unique IDs for the components inside the composite. So it is possible to include more than one composites on a single page.

The problems starts with the validation and the need to bind the inputText component. I need this to ask the validation outcome in the panelGroup for highlighting not only the inputField but also the label.

This code is working perfectly when using only one composite on a page. When using a second one, the inputField ‘firstname’ is not shown anymore. I guess it has to do with the binding and its hardcoded ‘#{firstname}’.

Now the question: How can I create a unique identifier for the binding attribute?

I’m thankful for any hint. Thanks!

  • 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-26T05:29:44+00:00Added an answer on May 26, 2026 at 5:29 am

    I suggest to create an alias with an unique ID and store it in request scope.

    <div id="#{cc.clientId}">
      <ui:param name="firstname" value="#{cc.clientId}_firstname" />
      <h:panelGroup styleClass="#{not requestScope[firstname].valid ? 'error' : ''}">
        <div class="col220">
            <h:outputLabel for="firstname" value="Vorname(n):" />
        </div>
        <div class="col220">
            <h:inputText id="firstname" styleClass="fmTxt " 
                value="#{cc.attrs.value}" binding="#{requestScope[firstname]}">
                <f:validateRequired />
            </h:inputText>
    
        </div>
      </h:panelGroup>
    </div>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem with following tutorial: http://www.mkyong.com/jsf2/jsf-2-internationalization-example/ In faces-context file you have to
One more question concerning JSF.Particularly, Primefaces. Have following problem with ajax update of elements
I'm using JSF 2.0 and Glassfish 3.1 and have the following problem: I've got
I'm a beginner in JSF and I´m having the following problem: I have a
I have a problem with the JSF-2.0 templating mechanism. I implement some snippet that
I have the following basic (and maybe stupid) understanding problem in JSF: There is
I have problem compilin this code..can anyone tell whats wrong with the syntax CREATE
I have a problem with a little .Net web application which uses the Amazon
I have a problem in my project with the .designer which as everyone know
I have a problem with JSF. Can anyone say why this doesn't work? <h:selectOneListbox

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.