composite-component

In JSF2, how to know if composite component has children?

烂漫一生 提交于 2019-12-01 05:51:28
I'm writing a composite component, you have a special tag named: <composite:insertChildren /> Which inserts all the component's children there. Is there any way to know whether the component has children? Like a boolean value that could go on a "rendered" attribute. The basic expression you're after is the following: #{cc.childCount} or more elaborately: #{component.getCompositeComponentParent(component).childCount} E.g. the following composite component: <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:cc="http://java.sun.com/jsf/composite" > <cc

Composite component required attribute throws exception in Mojarra 2.0.3

混江龙づ霸主 提交于 2019-12-01 05:27:33
问题 I've been playing around with JSF 2.0 composite components but I'm a bit confused as to what the require attribute in the composite:attribute tag is meant to do. The documentation says that the required attribute is true if the page author must supply a value for this attribute. I've interpreted that as meaning that a value must be supplied for all composite:attributes that have required=true . I also assumed that an empty string is a valid value. And this is how it worked in Mojarra 2.0.2.

Evaluating if MethodExpression attribute is set (getting PropertyNotFoundException)

元气小坏坏 提交于 2019-12-01 04:41:48
I have a UI component with a MethodExpression attribute changeListener : <composite:interface> <composite:attribute name="changeListener" required="false" method-signature="void actionListener(javax.faces.event.ActionEvent)" /> .. </composite:interface> <composite:implementation> <p:remoteCommand name="ajaxOnChange" update="#{cc.attrs.onChangeUpdate}" oncomplete="#{cc.attrs.onchange}" actionListener="#{cc.attrs.changeListener}" /> .. </composite:implementation> This changeListener attribute is an optional method expression used as actionListener in the remoteCommand and I want to render the <p

JSF 2.0: h:inputText inside composite component fails with non-String objects when validation is set

∥☆過路亽.° 提交于 2019-12-01 00:39:20
In a backing bean: @Min(3) Integer foo; If I have form like: <h:form> <h:commandButton value="Submit" /> <h:inputText value="#{bean.foo}" /> </h:form> This works ok. However, if I do something like <cc:interface> <cc:attribute name="text" /> <cc:editableValueHolder name="text" targets="field" /> <cc:interface> <cc:implementation> <h:inputText id="field" value="#{cc.attrs.text}" /> </cc:implementation> and call this inside form instead of directly h:inputText as in: <!-- <h:inputText value="#{bean.foo}" /> --> <pref:fieldComponent text="#{bean.foo}" /> But then I get: javax.validation

How to parameterize requiredMessage attribute in composite component?

为君一笑 提交于 2019-11-30 23:15:58
BalusC provided a good answer to a question about how to set messages per composite component. Specifying different error messages for different composite components The answer involved using per component resource bundles. Ive applied this approach but when I use {0} in the message to specify the current component label as part of the message, the {0} is rendered as is in my error, rather than being resolved. Is this resolution of labels available when I use this approach? Or do I have to manually build up the error message in the composite component? e.g. requiredMessage="#{cc

How to access the parent Naming Container of Composite?

不打扰是莪最后的温柔 提交于 2019-11-30 21:13:47
I have a JSP 2.0 <ui:component> , within that is a <p:dataTable> with a column that uses a Composite to render a special border about some content. Now I need to identify the <p:dataTabe> in a ajax rendered attribute that is located in the content. <ui:component> <p:dataTable id="dataTable" var="userItem" ... /> <p:column> <my:borderBox id="borderBox"> <p:commandButton action="#{userController.doDelete(userItem.id)}" value="delete" update="?????"/> <!-- How to address the dateTable? --> </my:borderBox> </p:column> </p:dataTable> <ui:component> My BorderBox: <html xmlns:composite="http://java

How to attach ajax event to composite component?

﹥>﹥吖頭↗ 提交于 2019-11-30 20:26:30
I have the following composite component (<v2:inputText2>) <!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:h="http://java.sun.com/jsf/html" xmlns:composite="http://java.sun.com/jsf/composite" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:rich="http://richfaces.org/rich"> <!-- INTERFACE --> <composite:interface> <composite:attribute name="baseId" required="true" /> <composite:attribute name="size" required="true" /> <composite:attribute name="value" required="true" />

JSF 2.0: h:inputText inside composite component fails with non-String objects when validation is set

落爺英雄遲暮 提交于 2019-11-30 19:59:52
问题 In a backing bean: @Min(3) Integer foo; If I have form like: <h:form> <h:commandButton value="Submit" /> <h:inputText value="#{bean.foo}" /> </h:form> This works ok. However, if I do something like <cc:interface> <cc:attribute name="text" /> <cc:editableValueHolder name="text" targets="field" /> <cc:interface> <cc:implementation> <h:inputText id="field" value="#{cc.attrs.text}" /> </cc:implementation> and call this inside form instead of directly h:inputText as in: <!-- <h:inputText value="#

How to parameterize requiredMessage attribute in composite component?

孤人 提交于 2019-11-30 18:29:24
问题 BalusC provided a good answer to a question about how to set messages per composite component. Specifying different error messages for different composite components The answer involved using per component resource bundles. Ive applied this approach but when I use {0} in the message to specify the current component label as part of the message, the {0} is rendered as is in my error, rather than being resolved. Is this resolution of labels available when I use this approach? Or do I have to

JSF2.0 - Composite component with optional method expression

非 Y 不嫁゛ 提交于 2019-11-30 15:34:18
问题 I'm implementing a composite component and I found a issue which I didn't find a solution. I specified its attributes that can or not be passed by the page author, but I couldn't specify a method attribute (a method expression to Action) that, if it wasn't passed, the composite component doesn't use the method attribute in the composite:implementation tag. Here my code: <composite:interface> <composite:attribute name="namePrompt" required="true"/> <composite:attribute name="actionMethod"