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

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.

Related

role attribute of h:panelGrid

I'm using exaples from the official Java EE tutorial In which contains the follow:
<h:panelGrid columns="2"
headerClass="list-header"
styleClass="list-background"
rowClasses="list-row-even, list-row-odd"
summary="#{bundle.CustomerInfo}"
title="#{bundle.Checkout}"
role="presentation">
But compiler says that attribute role is not defined for h:panelGrid component. How to fix this?
That attribute was introduced in JSF 2.2. As evidence, the role attribute is mentioned in JSF 2.2 <h:panelGrid> documentation, but not in JSF 2.1 <h:panelGrid> documentation.
Your question history confirms that you're using JSF 2.2 on GlassFish 4.0, so this compiler warning is actually wrong. This is not exactly a JSF problem, but an IDE problem. The IDE is somehow thinking that you're not using JSF 2.2, but JSF 2.1 or older. I.e. your toolset is working against you. You didn't mention which IDE you're using, so it's not possible to post the right answer.
If the project runs fine and the JSF page produces the right HTML output (i.e. the role attribute actually ends up in generated HTML <table> element as you can see by rightclick, View Source in webbrowser), then everything is well and it's just the IDE who's pretending to be smarter than it actually is.
I'd start peeking around in IDE project's properties to check if the JSF versions are all right. The JSF facet in project's properties must be set to version 2.2, not lower. The faces-config.xml must be declared conform JSF 2.2, not lower.

Difference between <f:subview> and <ui:composition> tags

What is the difference between <f:subview> and <ui:composition> tags? For what purposes and cases are each of these tags suiteble for?
The <f:subview> introduces a new NamingContainer layer and has initially (in JSF 1.0) been designed to be used in combination with JSP's <jsp:include> tag.
<f:subview id="foo">
<jsp:include page="/WEB-INF/include.jsp" />
</f:subview>
In JSF 2.0, which uses Facelets instead of JSP as default view technology, this tag has not really a value anymore.
The <ui:composition>, which is from JSP's successor Facelets, definies a template composition and allows the developers to design the HTML template in visual HTML editors like Dreamweaver. When actually used in a JSF/Facelets environment, any content outside <ui:composition> will be disregarded and only the inner content will be used to build the component tree. This tag can be used in both the include pages and template clients. See also How to include another XHTML in XHTML using JSF 2.0 Facelets?

Weblogic 10.3.4 jsf 1.2 encodes special characters

We have a web application, which uses weblogic jsf 1.2 implementation from deployable-libraries(jsf-1.2.war). We started to use weblogic jsf impl after having some problems with compatibility of packed jsf-impl and weblogic 10.3.4.
So the problem is that, we have outputLink with several params, these params' values could contain spacial chars, so we explicitly encode them(we have taglib function for this purpose), but jsf impl on weblogic 10.3.4 also encodes these chars, so we have double encoded link URL. Does anybody know is there a possibility to disable this option on weblogic and encode params only manually.
Just do not encode it yourself with a custom taglib. The <f:param> will already implicitly do it.
<h:outputLink value="page.jsf">
<h:outputText value="Click" />
<f:param name="foo" value="#{bean.foo}" />
<f:param name="bar" value="#{bean.bar}" />
</h:outputLink>
That's all. The #{bean.foo} and #{bean.bar} in above example can just return the raw and unencoded string value.
Update as per the comments, this suggests that those two servers JBoss AS 4.2.3 and WebLogic 10.3.2 are using a specific JSF implementation/version which exposes a bug in URL-encoding of <f:param>. As far, I can only find the following related reports (it's not clear if you're using MyFaces or Mojarra, so I searched in both):
Mojarra (a.k.a. Sun RI): http://java.net/jira/browse/JAVASERVERFACES-791 fixed in 1.2_10.
MyFaces: https://issues.apache.org/jira/browse/MYFACES-1832 fixed in 1.1.6 and > 1.2.2(?).
I recommend to replace/upgrade the JSF version of the servers in question to a newer version than the ones mentioned in those reports, or to ship JSF libraries along with the webapp itself and add web.xml context parameters to instruct the server to use the webapp bundled JSF instead.

how to generate dynamic rich:panelMenu?

i have a problem to generate dynamic menu, i'm using JSF1.2. I tried the c:forEach with an arrayList to generate dynamic rich:panelMenu as BalusC advised in a related forum, but get Accessor never triggered in c:forEach. it ruined me a day. can anyone provide me a solution ?
<c:forEach items="#{serviceListBean.services}" var="child">
<rich:panelMenuItem mode="none">
<h:outputText value="#{child.serviceId}"></h:outputText>
</rich:panelMenuItem>
</c:forEach>
what's wrong in this code? can anyone enlighten me?. For info, serviceListBean is request scoped bean.
Two possible causes:
JSTL is not declared as taglib in JSP or Facelets. To confirm this, rightclick page in browser and choose View Source. Do you see <c:forEach> tag unparsed among the generated HTML? If you're using JSP, declare it as follows:
<%#taglib prefic="c" uri="http://java.sun.com/jsp/jstl/core" %>
Or if you're using Facelets, declare it as follows in root element:
xmlns:c="http://java.sun.com/jsp/jstl/core"
On some servers like Tomcat, which doesn't ship with JSTL out the box, you would also need to install JSTL first, see also this info page.
This piece of code is in turn been placed inside a JSF repeating component, like <h:dataTable> with a var="serviceListBean". This is also not going to work. You would need to replace the JSF repeating component by <c:forEach> as well.

a4j:support tag not found using JSF 2

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.

Resources