composite-component

How to specify a validator for an input component inside a composite component?

笑着哭i 提交于 2019-11-27 23:16:45
Should I register a custom validator in faces-config.xml if I'm using JSF 2.0.4? My custom validator uses Validator interface which is javax.faces.validator.Validator . <cc:myComp id="customcomp1" ... /> <cc:myComp id="customcomp2" ...> <f:validator id="myvalidator" for="myComp" /> </cc:myComp> myComp.xhtml <cc:interface> <cc:attribute ... /> <!-- more attributes --> </cc:interface> <cc:implementation> <h:panelGroup layout="block"> <h:inputText id="firstName" ... /> <h:inputText id="middleName" ... /> <h:inputText id="lastName" ... /> </h:panelGroup> </cc:implementation> As per the code

How to render a composite component using a custom renderer?

与世无争的帅哥 提交于 2019-11-27 21:04:31
问题 I would like to know how to render a composite component, through Java, I mean I have: <myowntags:selectOneRadio> <f:selectItem itemValue="value0" itemLabel="This is the value 0" /> <f:selectItem itemValue="value1" itemLabel="This is the value 1" /> <f:selectItem itemValue="value2" itemLabel="This is the value 2" /> </myowntags:selectOneRadio> or <myowntags:selectOneRadio> <f:selectItems value="#{controller.items}" /> </myowntags:selectOneRadio> and I would like to create a Java class to

Initialize a composite component based on the provided attributes

馋奶兔 提交于 2019-11-27 20:16:15
I'm writing my custom table composite component with Mojarra JSF. I'm also trying to bind that composite to a backing component. The aim is to be able to specify the number of elements the table has in a composite attribute, later on the bound backing component will autogenerate the elements itself before view gets rendered. I've this sample code: Main page: <html xmlns="http://www.w3.org/1999/xhtml" xmlns:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html" xmlns:comp="http://java.sun.com/jsf/composite/comp"> <h:head /> <body> <h:form> <comp:myTable itemNumber="2" /> </h

Is it possible to use template with composite component in JSF 2?

荒凉一梦 提交于 2019-11-27 18:58:53
问题 <ui:composition xmlns="http://www.w3.org/1999/xhtml" ... template="inputLayout.xhtml"> <composite:interface> <composite:attribute name="name" /> <composite:attribute name="value" /> </composite:interface> <composite:implementation> <!-- <ui:define name="content"> --> <h:message for="textPanel" style="color:red;" /> #{cc.attrs.name} : <h:inputText id="name" value="#{cc.attrs.value}" /> <!-- <ui:define> --> </composite:implementation> </ui:composition> The problem is that even the ui:define is

JSF 2 - How can I add an Ajax listener method to composite component interface?

核能气质少年 提交于 2019-11-27 18:49:26
I have a JSF 2 composite component that employs some Ajax behavior. I want to add a listener method to the <f:ajax> tag inside my composite component, but the listener method should be provided as a <composite:attribute> in the <composite:interface> . The <f:ajax> tag inside my composite component is currently hard-coded to a listener like this: <f:ajax event="valueChange" execute="@this" listener="#{controller.genericAjaxEventLogger}" render="#{cc.attrs.ajaxRenderTargets}" /> The listener method on the bean has this signature: public void genericAjaxEventLogger(AjaxBehaviorEvent event) throws

Binding a managed bean instance to composite component

柔情痞子 提交于 2019-11-27 15:51:19
I have a composite component (collapsiblePanel). The component uses the "collapsible" bean to provide the toggle function. When I use the same component multiple times on a page, each instance of the component is bound to the same bean instance. How Can I achieve something like a component scoped bean? collapsibleTemp.xhtml : <cc:interface> <cc:attribute name="model" required="true"> <cc:attribute name="collapsed" required="true" /> <cc:attribute name="toggle" required="true" method-signature="java.lang.String f()" /> </cc:attribute> <cc:actionSource name="toggle" /> <cc:facet name="header" />

Using new xmlns.jcp.org namespace on composites causes java.lang.NullPointerException at java.util.concurrent.ConcurrentHashMap.putIfAbsent

送分小仙女□ 提交于 2019-11-27 14:31:29
I am reading The Java EE 7 Tutorial from http://docs.oracle.com/javaee/7/tutorial/doc/jsf-facelets005.htm#GIQZR After I typed the example code in the chapter 8.5 Composite Components in my IDE and run the example on GlassFish4.0, I got an error java.lang.NullPointerException at java.util.concurrent.ConcurrentHashMap.putIfAbsent(ConcurrentHashMap.java:1078) at com.sun.faces.util.Cache.get(Cache.java:116) at com.sun.faces.application.view.FaceletViewHandlingStrategy.getComponentMetadata(FaceletViewHandlingStrategy.java:237) at com.sun.faces.application.ApplicationImpl.createComponent

JSF 2 — Composite component with optional listener attribute on f:ajax

白昼怎懂夜的黑 提交于 2019-11-27 14:14:07
问题 I have a composite component that looks something like this: <!DOCTYPE html> <html xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:dm="http://davemaple.com/dm-taglib" xmlns:rich="http://richfaces.org/rich" xmlns:cc="http://java.sun.com/jsf/composite" xmlns:fn="http://java.sun.com/jsp/jstl/functions" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:a4j="http://richfaces.org/a4j"> <cc:interface> <cc:attribute name="styleClass" /> <cc:attribute name=

Nested JSF Composite Components leading to a Stack Overflow exception

江枫思渺然 提交于 2019-11-27 09:28:22
The problem When I attempt to nest a Composite Component within itself, with some logic to end the infinite recursion I receive a stack overflow exception. My understanding is that <c:xxx> tags run at view build time so I was not expecting to have an infinite view build as I presume has been the case. This is the composite component simpleNestable.xhtml <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:composite="http://java.sun.com/jsf/composite" xmlns:h="http://java.sun

Tag for body definiton in composite component

感情迁移 提交于 2019-11-27 08:35:33
问题 I am creating a composite component to use it in my application. I need to define for every composite component its own body. When I used JSP few years ago, I specified custom body in some tag file, for example titlebar.tag and future body was declared by tag below: <jsp:doBody /> and I used it in JSP file: <foo:titlebar> <jsp:body> something </jsp:body> </foo:titlebar> now I need to have something similar in JSF composite components between cc:implementation <cc:implementation> SOME TAG FOR