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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T17:30:36+00:00 2026-06-16T17:30:36+00:00

Possible Duplicate: How to make a grid of JSF composite component? I have a

  • 0

Possible Duplicate:
How to make a grid of JSF composite component?

I have a <p:panelGrid> with one column to produce the header and the footer.

enter image description here

The text is in Portuguese, it says “Fields are placed here! PS: inside the secound panel”.

Inside that <p:panelGrid>, I have a nested <h:panelGrid> which should contain the fields. I created a composite component to add labels and input fields. Here is the composite implementation:

<cc:implementation>
    <h:panelGrid columns="2">
        <p:outputLabel for="#{cc.attrs.fieldId}" value="#{cc.attrs.fieldLabel}"/>
        <p:inputText id="#{cc.attrs.fieldId}" required="#{cc.attrs.required}" disabled="#{cc.attrs.disabled}" 
            value="#{cc.attrs.targetValue}" styleClass="cc.attrs.styleClass">
            <cc:insertChildren /> <!-- Validation Rules -->
            <f:ajax event="blur" execute="@this" render="@this" />
        </p:inputText>      
    </h:panelGrid>          
</cc:implementation>

This should align the label and input in the grid. However, it renders something like as:

enter image description here

I tried removing the <h:panelGrid> from the composite component, but it also looks misaligned like this:

enter image description here

How can I align the labels and the inputs?

  • 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-16T17:30:37+00:00Added an answer on June 16, 2026 at 5:30 pm

    Here is what I did:

    My composite component doesn´t render the label, that way, I don´t have a panelGrid inside each component. The result is something like this:

    <cc:implementation>
        <p:inputText id="#{cc.attrs.fieldId}" required="#{cc.attrs.required}" disabled="#{cc.attrs.disabled}" 
                     value="#{cc.attrs.targetValue}" styleClass="cc.attrs.styleClass">
    
            <cc:insertChildren /> <!-- Validation Rules -->
            <f:ajax event="blur" execute="@this" render="@this" />
    
        </p:inputText>      
    </cc:implementation>
    

    That way, the label needs to have this:

                <h:panelGrid columns="2" cellspacing="5" styleClass="table_form">  
    
                <p:outputLabel for="inputId:id" value="#{msg['entity.id']}"/>
                <po:inputInteiro id="inputId" targetValue="#{campoController.entity.id}" fieldId="id" disabled="true" styleClass="inputTiny"/>
    

    Need to pay attention because if you don´t give the ID to your composite component, and try to look for just the inner id, JSF won´t find your component. Here is the exception if you don´t do the right way: javax.faces.FacesException: Cannot find component with identifier “id” referenced from “mainForm:j_idt78”

    The final result was:

    Another note: primefaces doesn´t include the “*” on required fields anymore… Needs to be done manually… 🙁

    Hope this helps!

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

Sidebar

Related Questions

Possible Duplicate: How to make return key on iphone make keyboard disappear? I have
Possible Duplicate: ASP.Net:Best way to run scheduled tasks I have to make a scheduled
Possible Duplicate: Sleep Less Than One Millisecond How can I make a program sleep
Possible Duplicate: Replace individual list elements in Haskell? I have managed to make some
Possible Duplicate: make drop down list item unselectable I have an asp.net dropdownlist and
Possible Duplicate: Make error: missing separator Have this code in makefile: PROG = semsearch
Possible Duplicate: CSS to make HTML page footer stay at bottom of the page
Possible Duplicate: RegEx to make sure that the string contains at least one lower
Possible Duplicate: How to make text glow? I am wondering how to add an
Possible Duplicate: C# - Make a borderless form movable? I have made a form

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.