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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T13:29:07+00:00 2026-06-08T13:29:07+00:00

Is it possible to declare a composite-component in such a way that it can

  • 0

Is it possible to declare a composite-component in such a way that it can just be placed inside certain tags?

E.g that:

<span>
    <n:myComponent/>
</span>

would be illegal, while:

<div>
    <n:myComponent/>
</div>

would be legal.

  • 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-08T13:29:09+00:00Added an answer on June 8, 2026 at 1:29 pm

    Not during buildtime, but during rendertime you could check the siblings of the component.

    public void encodeChildren(FacesContext context) {
        List<UIComponent> children = getParent().getChildren();
        // Loop over children until you find a child which equals to "this".
        // Then check if the previous and next sibling contains <span> and </span>.
        // ...
    
        if (valid) {
            super.encodeChildren(context);
        } else {
            throw new IllegalArgumentException("n:myComponent can't be placed inside <span>");
        }
    } 
    

    You can do this in an UINamingContainer implementation which is as @FacesComponent referenced by <cc:interface componentType>.

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

Sidebar

Related Questions

Is it possible to declare a function pointer (non C++ 11) that can point
Possible Duplicate: Cannot declare Public static final String s = new String(“123”) inside an
Possible Duplicate: declare property as object? in java you can create an object directly
Is it possible to declare and manage several custom content types inside one module?
Just wondering if it is possible to declare a function of an enumerated type
Is it possible to declare class variable outside of if-else and initialize it inside
Is it possible to declare a constant Guid in C#? I understand that I
in C#, is it possible to declare an Enum that is only visible within
Is it possible to declare that a column in MySQL should be unmodifiable once
Is it possible to declare global variables in MATLAB inside a loop: cellvar =

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.