a4j:support tag not found using JSF 2 - jsf

just trying to integrate this commandLink
<a4j:commandLink reRender="results-view" actionListener="#{myaction}" oncomplete="return false;" value="#{msg1.advanced_search}">
<a4j:support event="onclick">
<f:setPropertyActionListener value="./page.xhtml" target="#{changeViews['new-view'].value}" />
</a4j:support>
</a4j:commandLink>
On an applicacion which is using JSF2. If I leave it, I get this error
Tag Library supports
namespace: http://richfaces.org/a4j,
but no tag was defined for name:
support
I was trying to find something on the net, but I couldn't figure out. Some help would be great.
Thanks in advance

The a4j:support has been replaced by a4j:ajax since RichFaces 4.x.
You seem to be reading RichFaces 3.x documentation or just have upgraded RichFaces 3.x to 4.x. This is a pretty major step where a lot of things are been changed. Read the migration guide (in this particular case, it's described in a4j components) and also read the new RF4 component reference.

Related

How to add tooltip to f:selectItems

For example the f:selectItems component doesn't support the title attribute in some versions of JSF.
Would it be possible to replace JSF Components by their plain HTML counterparts using JSFC and do something like this?
<select jsfc="h:selectOneMenu" value="#{cc.data}">
<option jsfc="f:selectItems" value="${cc.listItems}" var="item" title="#{item.tooltip}"></option>
</select>
instead of
<h:selectOneMenu value="#{cc.data}">
<f:selectItems value="#{cc.listItems}" />
</h:selectOneMenu>
Doing exactly so, replacing the latter by the above, I'm getting "<f:converter> Parent not an instance of ValueHolder: javax.faces.component.html.HtmlPanelGroup" Facelet TagExceptions
Would it be possible to replace JSF Components by their plain HTML counterparts using JSFC and do something like this
Nope. Ultimately, such a HTML element with jsfc attribute will be turned into a true JSF component in the JSF component tree and only the attributes supported by the component in question would be parsed and set as component attribute. The title attribute isn't among the supported attributes of UISelectItem component. I'm not sure what exactly you mean with "some versions of JSF". The standard JSF API already doesn't support it in first place. JSF spec issue 529 describes this shortcoming and is currently still open.
If you're using JSF 2.2, make use of passthrough attributes. You only need to replace <f:selectItems> by <c:forEach><f:selectItem>, see also Using f:selectItems var in passtrough attribute
<... xmlns:a="http://xmlns.jcp.org/jsf/passthrough">
<c:forEach value="#{bean.items}" var="item">
<f:selectItem itemValue="#{item}" a:title="#{item.tooltip}" />
</c:forEach>
Based on your question history you seem to be not using JSF 2.2 yet. If you can't upgrade, you basically need a custom renderer for <h:selectOneMenu>.
While creating the custom renderer, you could make use of the unused(!) description property of the UISelectItem class. I've answered this before on a similar question targeted at <p:selectManyCheckbox>: Primefaces tooltip for p:selectManyCheckbox or other p:selectMany*/One*.
<f:selectItems ... var="item" itemDescription="#{item.tooltip}" />
Noted should be that creating the custom renderer for <h:selectOneMenu> is a pain, particularly if you intend to be JSF implementation independent. Theoretically, a custom ResponseWriter should be able to catch this, but unfortunately, the <h:selectOneMenu> only passes itself when writing <option>, instead of the UISelectItem in question.
In my case (JSF 2.2 / Mojarra 2.2.14), itemDescription worked out of the box. I.e:
<c:forEach items="#{bean.items}" var="item">
<f:selectItem itemValue="#{item}" itemLabel="#{item}" itemDescription="#{item.tooltip}" />
</c:forEach>

h:commandLink on render shows org.apache.myfaces though it's ibm faces which has been used

This is a peculiar thing that i have observed. I have a h:commandLink inside a h:datatable. The commandLink code looks like this :
<h:commandLink value="#{grease.greaseId}" rendered="#{MyBean.btnName == 'ending'}" id="greaseNo1" action="#{MyBean.greaseIdMonitored}" immediate="true">
<f:param name="id" value="#{grease.greaseId}" />
</h:commandLink>
This is rendered as the following html :
<script src="/grease/faces/javax.faces.resource/oamSubmit.js?ln=org.apache.myfaces" type="text/javascript"><!--
//--></script><a id="myForm:dt1:0:greaseNo1" onclick="return myfaces.oam.submitForm('myForm','myForm:dt1:0:greaseNo1',null,[['id','mylot-256987']]);" href="#">mylot-256987</a>
What i don't understand is why is there a reference to org.apache.myfaces ? I am not using myfaces, rather it's ibm faces.
Any help in understanding the problem is appreciated .
From the WAS documentation:
In WebSphere® Application Server V8.0 and later, the default JavaServer Faces (JSF) implementation has changed to MyFaces.
There is no IBM Faces as such (though IBM has proprietary component libraries and extensions.) IBM has always based their JSF implementations on either the licensed reference implementation or open source software. See the WAS 8.5 documentation on how to configure the platform's JSF engine.
the oamSubmit.js file is located inside a resource folder, called org.apache.myfaces
Take a look at the implementation file.

What is LimitToList in JSF, RichFaces? Is it removed in RichFaces 4.x?

What is limitToList in JSF, RichFaces? Is it removed in RichFaces 4.x? Are limitToList and limitRender the same?
limitRender in RichFaces 4.x is what limitToList is for RichFaces 3.x.
Except for limitReder is achieved through render attribute and limitToList is achieved through reRender attribute
Below is the explanation from RichFaces reference guide 3.x for limitToList.
"limitToList" attribute allows to dismiss the behavior of the "ajaxRendered" attribute. limitToList = "true" means to update only the area(s) that mentioned in the "reRender" attribute explicitly. All output panels with ajaxRendered="true" is ignored. An example is placed below:
...
<h:form>
<h:inputText value="#{person.name}">
<a4j:support event="onkeyup" reRender="test" limitToList="true"/>
</h:inputText>
<h:outputText value="#{person.name}" id="test"/>
</form>
...
Below is the explanation for limitRender from RichFaces development guide.
RichFaces Ajax-enabled components and Ajax behaviors with limitRender="true" specified will not cause components with ajaxRendered="true" to re-render, and only those components listed in the render attribute will be updated. This essentially overrides the ajaxRendered attribute in other components.
References for RichFaces 3.x and 4.x can be found below.
RichFaces 4.x development guide
RichFaces 3.x reference guide
RichFaces Migration Guide. 3.3.x - 4.x Migration - Common components changes

Undefined javascript with richfaces

wonder if you can help me. For some reason, I am getting javascript errors for my richface components, and this has seemed to have happened without any changes to the code that was working correctly just a few days ago.
Anyway, as an example I am using a rich:componentControl as follows:
<a4j:commandButton onclick="#{rich:component('headerpopup')}.show()" id="addheader" styleClass="saveState" value="Add Column Header">
<rich:componentControl for="headerpopup" attachTo="addheader" operation="show" event="onclick"/>
</a4j:commandButton>
And the javascript error I get is:
Uncaught TypeError: Cannot call method 'show' of undefined
I'm suspecting I am missing a javascript file that Richfaces should be providing, is this correct?
I'm using Richfaces 3.3.1 on Jboss 5.1.0 and Seam 2.2.2.
Any help would be helpful.
oops....
It was a schoolboy error:
I had removed the jQuery noConflict line, not knowing what it was...
<script>var $e = esiQuery.noConflict();</script>

Primefaces Watermark on Rich Calendar

I am using JSF 1.2, Richfaces 3.3.1 and I am trying to display a watermark in <rich:calendar>.
I thought of using Watermark tag of primefaces <p:watermark> and so i have included primefaces1.1.jar in my classpath. It works fine for input text, but when i tried it on Calendar by using forElement of Watermark it didn't work.
Please find the below code snippet, where I used the generated client id in the forElement attribute.
<p:watermark forElement = "#includeId:GroupMasterForm:arrDateInputDate input" value="dd/mm/yyyy"/>
Is there any workaround for that? Thanks in advance.
Some suggestions:
I think the problem is that you try to combine two different component libraries. I am not sure if this works at all.
You could try to use p:calendar instead of rich:calendar in order to test if this is the cause.
Furthermore, I think your forElement content might be a reason. If calendar and watermark are siblings you can simply use the id of the calendar instead of the whole path.
Try this one:
<rich:calendar value="#{dataModel.date}" id="date"
datePattern="dd.MM.yyyy" enableManualInput="true"
showApplyButton="false" inputClass="watermark" required="true"/>
<p:watermark forElement=".watermark" value="TT.MM.JJJJ"/>
remember to define the p:watermark tag outside of rich:calendar

Resources