composite-component

How to define the content of repeater inside composite through its interface?

依然范特西╮ 提交于 2019-12-05 18:37:19
I have a composite component with a ui:repeat and want to define the content of the ui:repeat through the interface of the composite. Following code is working in MyFaces but looks more like a hack since variable name varRepeat must be known outside of composite and it only works if no other childrens are provided that should be rendered somewhere else. View Define content of the ui:repeat <comp:myRepeater value="#{of:createIntegerArray(1,5)}"> <h:outputText id="varComp" value="#{varRepeat}"/> </comp:myRepeater> Composite myRepeater <composite:attribute name="value" type="java.lang.Object"/>

Composite component folder structure

*爱你&永不变心* 提交于 2019-12-05 17:08:12
JSF spec 2.2 (2013-03-20) says in item 10.3.3.1 (Declaring a composite component library for use in a Facelet page): If a facelet taglibrary is declared in an XHTML page with a namespace starting with the string “ http://java.sun.com/jsf/composite/ ” (without the quotes), the remainder of the namespace declaration is taken as the name of a resource library [...] If the substring following “ http://java.sun.com/jsf/composite/ ” contains a “/” character, or any characters not legal for a library name the following action must be taken. If application.getProjectStage() is Development an

<f:ajax render> not working via <composite:clientBehavior>

微笑、不失礼 提交于 2019-12-05 14:16:44
I have a composite component which has ajax: <composite:interface> <composite:attribute name="question" required="true"/> <composite:attribute name="value" required="false"/> <composite:attribute name="id" required="true" /> <composite:clientBehavior name="alter" event="change" targets="input"/> </composite:interface> <composite:implementation> <label for="#{cc.attrs.id}"> <h:outputText value="#{cc.attrs.question}" /> </label> <div class="fld"> <h:selectOneRadio value="#{cc.attrs.value}" id="input"> <f:selectItem itemValue="true" itemLabel="Yes" /> <f:selectItem itemValue="false" itemLabel="No

Duplicate component ID in JSF using composite component twice in view

南楼画角 提交于 2019-12-05 11:12:45
I "inherited" a JSF 2 (JSF 2.2.7) application in my company and facing a java.lang.IllegalStateException because two component seem to have the same ID. The structure of the view is as follows (I extracted the relevant code for illustration purpose, it may contain some typos/invalid syntax as I changed some names): <p:commandButton id="editButton" action="#{controller.prepareItem()}" update=":itemEditDlg" oncomplete="PF('itemtEditDlg').show()" /> <comp:editItemDlg id="itemEditDlg" /> <p:dialog id="anotherDlg" > <h:form id="anotherForm"> <c:forEach items="#{controller.allArgs}" var="arg" > <!--

JSF2.0 Composite Component actionListener

旧街凉风 提交于 2019-12-05 08:44:45
I am in need of some assistance in getting my Composite Component to behave. I am still learning the ropes in JSF, so please excuse any ignorance that might be displayed in this post. So, I am working with JSF 2.0 and decided to build a composite component to make this particular code snippet reusable. The component displays everything perfectly, but will not behave at all when trying to add the actionListener. Here is the code for my component <ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:f="http:/

JSF Iterative composite component with customizable content

眉间皱痕 提交于 2019-12-05 02:23:27
问题 I want to create a composite component where to acutal layout of of iterating elements can be passed to the composite. This is a simplified example and works: <composite:interface> <composite:attribute name="value"/> </composite:interface> <composite:implementation> <ul> <c:forEach var="i" items="#{cc.attrs.value}"> <li> <h:outputText value="Test #{i.name}"/> </li> </c:forEach> </ul> But I don't want the h:outputText to be hardcoded in the component. When using the component I'm trying to

How to create a composite component which switches between inputText and inputSecret?

懵懂的女人 提交于 2019-12-04 16:17:36
I'm writing a Facelets composite component that switches between using inputText and inputSecret based on a parameter: <composite:interface> <composite:attribute name="myId" required="true"/> <composite:attribute name="secret" required="false" default="false" /> </composite:interface> <composite:implementation> <h:inputSecret rendered="#{cc.attrs.secret}" id="#{cc.attrs.myId}" /> <h:inputText rendered="#{!cc.attrs.secret}" id="#{cc.attrs.myId}" /> </composite:implementation> The problem is that I get the following error: Component ID [JSF mangled id] has already been found in the view. BalusC

JSF 2.0 composite component into jar

匆匆过客 提交于 2019-12-04 15:53:49
I'm trying create a composite component to use across my projects, so, I've created a project called "componentes-ui-web" and putted 2 xhtml files that are my components. The structure of the project is like this: src > |-> main > > |->java > > |->META-INF > > |->faces-config.xml > > |->resources > > |->componentes > > |->popupSimples.xhtml > > |->popupSubmit.xhtml This is the code of popupSubmit.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:ui="http://java.sun

Using one component (dataTable) id inside composite component

核能气质少年 提交于 2019-12-04 12:24:07
How can I use id of DataTable Component (Primefaces 2.2.1) inside Composite Component in Java Server Faces 2.1 ? Now, I have a view: <?xml version='1.0' encoding='UTF-8' ?> <!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <ui:composition xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:p="http://primefaces.prime.com.tr/ui" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:haiq="http://java.sun.com/jsf/composite/haiqcomponents" template="/WEB

jsf difference between implicit objects cc and component

此生再无相见时 提交于 2019-12-04 12:14:02
Maybe this is a dumb question, but I use cc to refer to the composite component, for instance cc.attrs.randomAttr but I have also seen the component implicit object and I have used it because I was told to but I don't really understand what it is for. Can anyone explain please? cc refers to the top level composite component that is being processed at the time of evaluation. component simply is the ui component being processed. So when inside a composite component, cc refers to the 'parent' component, while component when used on an individual component refers to that particular instance. Or