I am developing a JSF 2.2.12 application with IntelliJ IDEA 2016.2.1 Ultimate. The problem is that many of the attributes of ui:repeat (and possibly other components) are missing.
For example, I'd like to use the step attribute of ui:repeat, as defined here. When I attempt to use it, this is what happens:
If I ctrl + click on repeat to go to its source, and I am taken to the file
...\IntelliJ IDEA 2016.2.1\plugins\JSF\lib\jsf-support.jar!\resources\schemas\ee7\tld\jsf-ui.tld
which has this definition of repeat:
<tag>
<name>repeat</name>
<tag-class></tag-class>
<tei-class></tei-class>
<body-content>JSP</body-content>
<description>
<![CDATA[
The repeat tag should be used in almost all cases instead of the c:forEach to iterate over content with JSF.
The repeat tag is often used in conjunction with the jsfc feature.
]]>
</description>
<attribute>
<name>id</name>
<required>false</required>
<rtexprvalue>false</rtexprvalue>
<description></description>
</attribute>
<attribute>
<name>value</name>
<required>true</required>
<rtexprvalue>false</rtexprvalue>
<description>The name of a collection of items that this tag iterates over. The collection may be a List, array, java.sql.ResultSet, or an individual java Object. If the collection is null, this tag does nothing.</description>
</attribute>
<attribute>
<name>var</name>
<required>true</required>
<rtexprvalue>false</rtexprvalue>
<description>The literal name of the variable to use while iterating.</description>
</attribute>
</tag>
The only attributes defined are id, value, and var! Why are the other attributes not here?
Here is my pom.xml entry for JSF:
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.2.12</version>
<scope>provided</scope>
</dependency>
Related
I wanted to understand the difference between and in Hybris for Model creation. How do they function internally?
<model generate="false"/> can be used in some contexts:
1) In <itemtype> to exclude the type from being created (including all subtypes) and can be used like in this example:
<itemtype ....>
<model generate="false"/>
</itemtype>
2) In <attribute> context to exclude the attribute from being created. The result is that neither the private field nor getter and setter methods are generated!
<attribute ...>
<model generate="false"/>
</attribute>
I didn't found any utility yet for this case.
The <itemtype generate="false/true"/> is used to specify to generate the Java class files or not (for getters/setters).
You can read here more information about <model/> tag (create custom getters/setters/constructors for an itemtype)
For an xp:inputtext control I would like to add the attribute [aria-required='true'] but I am wondering how I could achieve that via the attributes property without having to set a label?
I have tried:
<xp:this.attrs>
<xp:attr>
<xp:this.value><![CDATA[[aria-required='true']]]></xp:this.value>
</xp:attr>
</xp:this.attrs>
But then I get as error message:
Description Resource Path Location Type Required property "name" for
xp:attr is not present.
I am not sure I understand what you mean by "without having to set the label".
<xp:attrs> holds a collection of one or more <xp:attr> components. Then the <xp:attr> component holds 2 attributes name= (String only) and value= (String only).
So if you want to set a custom attribute for the HTML counterpart tag you must write:
<xp:inputText ...>
<xp:this.attrs>
<xp:attr name="aria-required" value="true" />
</xp:this.attrs>
</xp:inputText>
If you want to kind of automate the presence of certain attributes you can also define a theme rule and apply it (of course if you have other styles and/or rules usually applied to the input you must make sure to repeat them again in the new rule):
The theme rule
<control>
<name>Input.AriaRequired</name>
<property>
<name>attrs</name>
<complex type="xp_attr">
<property>
<name>name</name>
<value>aria-required</value>
</property>
<property>
<name>value</name>
<value>true</value>
</property>
</complex>
</property>
</control>
The input with the applied theme
<xp:inputText themeId="Input.AriaRequired" ... />
I wrote an new renderer for a primefaces component, now i want to make have this "new" component available under a new namespace:
I created a new taglib for that:
<facelet-taglib xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facelettaglibrary_2_0.xsd"
version="2.0">
<namespace>http://www.whitebyte.com/commentbox</namespace>
<tag>
<tag-name>tree</tag-name>
<component>
<component-type>org.primefaces.component.Tree</component-type>
<renderer-type>commentbox.CustomTreeRenderer</renderer-type>
</component>
<attribute>
<description><![CDATA[Unique identifier of the component in a namingContainer.]]></description>
<name>id</name>
<required>false</required>
<type>java.lang.String</type>
</attribute>
<attribute>
<description><![CDATA[Boolean value to specify the rendering of the component, when set to false component will not be rendered.]]></description>
<name>rendered</name>
<required>false</required>
<type>java.lang.Boolean</type>
</attribute>
<attribute>
<description><![CDATA[An el expression referring to a server side UIComponent instance in a backing bean.]]></description>
<name>binding</name>
<required>false</required>
<type>javax.faces.component.UIComponent</type>
</attribute>
<attribute>
<description><![CDATA[Name of the client side widget.]]></description>
<name>widgetVar</name>
<required>false</required>
<type>java.lang.String</type>
</attribute>
<attribute>
<description><![CDATA[A TreeNode instance as the backing model.]]></description>
<name>value</name>
<required>false</required>
<type>java.lang.Object</type>
</attribute>
<attribute>
<description><![CDATA[Name of the request-scoped variable that'll be used to refer each treenode data during rendering.]]></description>
<name>var</name>
<required>false</required>
<type>java.lang.String</type>
</attribute>
<attribute>
<description><![CDATA[Specifies the ajax/client toggleMode. Default is false.]]></description>
<name>dynamic</name>
<required>false</required>
<type>java.lang.Boolean</type>
</attribute>
<attribute>
<description><![CDATA[Specifies caching on dynamically loaded nodes. When set to true expanded nodes will be kept in memory. Default is true.]]></description>
<name>cache</name>
<required>false</required>
<type>java.lang.Boolean</type>
</attribute>
<attribute>
<description><![CDATA[Javascript event to process when a tree node is clicked.]]></description>
<name>onNodeClick</name>
<required>false</required>
<type>java.lang.String</type>
</attribute>
<attribute>
<description><![CDATA[TreeNode array to reference the selections.]]></description>
<name>selection</name>
<required>false</required>
<type>java.lang.Object</type>
</attribute>
<attribute>
<description><![CDATA[Style of the main container element of tree.]]></description>
<name>style</name>
<required>false</required>
<type>java.lang.String</type>
</attribute>
<attribute>
<description><![CDATA[Style class of the main container element of tree.]]></description>
<name>styleClass</name>
<required>false</required>
<type>java.lang.String</type>
</attribute>
<attribute>
<description><![CDATA[Defines the selectionMode.]]></description>
<name>selectionMode</name>
<required>false</required>
<type>java.lang.String</type>
</attribute>
<attribute>
<description><![CDATA[Highlights nodes on hover when selection is enabled, set to false to disable highlighting.]]></description>
<name>highlight</name>
<required>false</required>
<type>java.lang.Boolean</type>
</attribute>
<attribute>
<description><![CDATA[Unique key of the data presented by tree nodes.]]></description>
<name>datakey</name>
<required>false</required>
<type>java.lang.Object</type>
</attribute>
<attribute>
<description><![CDATA[When enabled, Displays slide effect during toggling of a node.]]></description>
<name>animate</name>
<required>false</required>
<type>java.lang.Boolean</type>
</attribute>
</tag>
I added the render in faces-config.xml too:
<render-kit>
<renderer>
<component-family>org.primefaces.component</component-family>
<renderer-type>commentbox.CustomTreeRenderer</renderer-type>
<renderer-class>commentbox.CustomTreeRenderer</renderer-class>
</renderer>
</render-kit>
The new component is also seen in eclipse but when i open the page in the browser i get:
javax.faces.FacesException: Cannot find component with identifier "tree" referenced from "j_idt62:j_idt76".
at org.primefaces.util.ComponentUtils.findClientIds(ComponentUtils.java:273)
at org.primefaces.util.AjaxRequestBuilder.addIds(AjaxRequestBuilder.java:102)
at org.primefaces.util.AjaxRequestBuilder.update(AjaxRequestBuilder.java:90)
at org.primefaces.renderkit.CoreRenderer.buildAjaxRequest(CoreRenderer.java:196)
at org.primefaces.component.commandbutton.CommandButtonRenderer.encodeMarkup(CommandButtonRenderer.java:74)
at org.primefaces.component.commandbutton.CommandButtonRenderer.encodeEnd(CommandButtonRenderer.java:49)
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:875)
at org.primefaces.renderkit.CoreRenderer.renderChild(CoreRenderer.java:59)
at org.primefaces.renderkit.CoreRenderer.renderChildren(CoreRenderer.java:43)
at org.primefaces.component.outputpanel.OutputPanelRenderer.encodeEnd(OutputPanelRenderer.java:46)
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:875)
at org.primefaces.renderkit.CoreRenderer.renderChild(CoreRenderer.java:59)
at org.primefaces.renderkit.CoreRenderer.renderChildren(CoreRenderer.java:43)
at org.primefaces.component.outputpanel.OutputPanelRenderer.encodeEnd(OutputPanelRenderer.java:46)
at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:875)
at com.sun.faces.renderkit.html_basic.HtmlBasicRenderer.encodeRecursive(HtmlBasicRenderer.java:312)
at com.sun.faces.renderkit.html_basic.GroupRenderer.encodeChildren(GroupRenderer.java:105)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845)
at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1779)
at com.sun.faces.renderkit.html_basic.CompositeRenderer.encodeChildren(CompositeRenderer.java:78)
at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:845)
The solution was to create the "whole" component and register that in the taglib like described here:
https://stackoverflow.com/a/10569044/441907
(I didn't register the taglib just put it into META-INF in classes that worked).
we have following taglib:
<facelet-taglib version="2.0" xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facelettaglibrary_2_0.xsd">
<namespace>http://www.example.com/mytaglib</namespace>
<composite-library-name>common</composite-library-name>
<tag>
<tag-name>selectOneRadio</tag-name>
<component>
<component-type>psa.selectOneRadio</component-type>
<renderer-type>psa.selectOneRadioRenderer</renderer-type>
</component>
<attribute>
<name>styleClass</name>
<type>java.lang.String</type>
</attribute>
<attribute>
<name>itemStyleClass</name>
<type>java.lang.String</type>
</attribute>
</tag>
The tag lib combines composite components in /resources/common (composite-library-name) and java written components.
It all works fine, but when using the selectOneRadio (java) component, we get the following error (but without a "real" error -> the selectOneRadio component also works fine):
08:31:31,202 ERROR [ResourceImpl:98] Resource handler [com.sun.faces.application.resource.ResourceHandlerImpl#1c22bcb0] was unable to create a resource for resourceName=[selectOneRadio.xhtml] libraryName=[common] contentType [application/xhtml+xml]
Its clear, because the selectOneRadio component is a java written component, the selectOneRadio.xhtml does not exist.
Thanks
Dirk
I would like to use jsf4birt to put birt report into xhtml pages. I tried to deploy exadel-jsf4birt-demo.war under jboss 6 but failed. Max#exadel said that jsf4birt only suppourts JSF 1.2, so does anyone have experience of using jsf4birt under JBoss 6? Thanks.
I figured this out. There is a bug in jsf4bir's tag definition file jsfbirt.tld:
<attribute>
<description>Defines UI Option name</description>
<name>name</name>
<deferred-value>
<type>java.lang.String</type>
</deferred-value>
<required>true</required>
</attribute>
this should be:
<attribute>
<description>Defines UI Option name</description>
<name>name</name>
<required>true</required>
<deferred-value>
<type>java.lang.String</type>
</deferred-value>
</attribute>