New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TagException: Components#includeCompositeComponent and required attributes #167

Closed
aadhoc opened this Issue Sep 18, 2015 · 1 comment

Comments

Projects
None yet
2 participants
@aadhoc

aadhoc commented Sep 18, 2015

When I make some attributes required, they appear to be validated before I can set them when includeCompositeComponent() returns. The error below shows the exception when required="true", but no errors when required="false".

Workaround: Make all attributes required="false"

Composite:

<?xml version="1.0" encoding="ISO-8859-1" ?>

<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:composite="http://java.sun.com/jsf/composite"
    xmlns:h="http://java.sun.com/jsf/html">

    <composite:interface>
        <composite:attribute name="title" required="true" type="String"/>
    </composite:interface>

    <composite:implementation>
        <h:outputText value="#{cc.attrs.title}"/>
    </composite:implementation>
</html>

Code:

        UIComponent composite = Components.includeCompositeComponent(
                topGroup,
                "com/aadhoc",
                "TestControl.xhtml",
                "test_control");
        composite.getAttributes().put("title", "This is a test");

Exception:

Caused by: javax.faces.view.facelets.TagException: null The following attribute(s) are required, but no values have been supplied for them: title. 
    at com.sun.faces.facelets.tag.composite.InterfaceHandler.validateComponent(InterfaceHandler.java:232)
    at com.sun.faces.facelets.tag.composite.InterfaceHandler.apply(InterfaceHandler.java:125)
    at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:95)
    at com.sun.faces.facelets.compiler.NamespaceHandler.apply(NamespaceHandler.java:93)
    at com.sun.faces.facelets.compiler.EncodingHandler.apply(EncodingHandler.java:87)
    at com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:312)
    at com.sun.faces.facelets.impl.DefaultFacelet.include(DefaultFacelet.java:371)
    at com.sun.faces.facelets.impl.DefaultFaceletContext.includeFacelet(DefaultFaceletContext.java:326)
    at org.omnifaces.util.Components.includeCompositeComponent(Components.java:615)

@BalusC BalusC closed this in 5264f37 Sep 22, 2015

@BalusC

This comment has been minimized.

Show comment
Hide comment
@BalusC

BalusC Sep 22, 2015

Member

I added a new includeCompositeComponent() method taking an attribute map. It's available in today's latest snapshot. Can you give it a try?

Member

BalusC commented Sep 22, 2015

I added a new includeCompositeComponent() method taking an attribute map. It's available in today's latest snapshot. Can you give it a try?

BalusC added a commit that referenced this issue Sep 23, 2015

@BalusC BalusC added the bug label Oct 3, 2015

BalusC added a commit that referenced this issue Oct 24, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment