I'm using NetBeans 8.0.2 and Mojarra 2.2 where according to the docs there's a media attribute and this is not the case, I get the following message:
The attribute media is not defined in the component outputStyleSheet
So the problem I know is with NetBeans 8.0.2. When I launch the application, It runs properly so does anyone know why NetBeans shows this error ?
It's documentary bug in the tag library declaration file of the Mojarra implementation. The Mojarra guys forgot to declare the media attribute of outputStylesheet tag in the html_basic.taglib.xml file. Netbeans is relying its tag/attribute validation on it and therefore gives false warnings.
The tag library declaration entry of the attribute is not necessary for the technical functioning of the attribute (not in components, tagfiles, nor composites) and that's why it just works fine.
The same documentary bug problem is known with below tag attributes:
<ui:fragment rendered> - fixed in Mojarra 2.1
<f:selectItem itemEscaped> - fixed in Mojarra 2.2
If you report the <h:outputStylesheet media> documentary bug, it'll likely be fixed in Mojarra 2.3.
Related
I want to use the rendered attribute in a ui:fragment to conditionally render a span element in my JSF 2.2 facelet. The JSF 2.2 documentation of ui:fragment lists rendered as an allowed attribute. I am using MyFaces 2.2.12 as JSF implementation, however, and the MyFaces 2.2 documentation of ui:fragment does not list rendered as a valid attribute.
I tried using rendered anyway, and it worked. However, my IDE - IntelliJ - rightly highlights the rendered attribute as an error and tells me it is not allowed in the ui:fragment element.
I saw a response in ui:fragment rendered attribute not working after upgrading Facelets to JSF 2 that there was a documentation bug where rendered falsly wasn't listed in the JSF 2.0 documentation, but the response says nothing about JSF 2.2 or MyFaces 2.2 (presumably because it dates before the release of JSF 2.2).
Is the missing rendered attribute in the MyFaces documentation also just a bug?
With multiple such occurances of the ui:fragment element in a single Facelets file, these "false" errors make finding real errors quite cumbersome. What is the recommended solution for this problem, if it really is just a bug in the documentation?
rendered is valid attribute in ui:fragment and ui:component in JSF 2.0, 2.1, 2.2. See JSF 2.2 View Declaration Language.
Some IDEs do not propose this attribute in autocomplete (content assistant) mode and validate it as "Unknown attribute". This happens because the rendered attribute was missing in the tag file declaration in JSF 2.0 (even if attribute was presented in the UIComponent) and the IDE validation is based on the tag file declarations. Issue was fixed in JSF 2.1: the missing attribute was added into the tag file declaration. Validation in IDE not always reflect to this change.
I am new to JSF 2.0.
My current project is build on JSF 1.3 and Richfaces 3.3.
We are trying to migrate to JSF 2.0.
There is limitation to not use Richface 3.3 or 4.0 in Current Project or any third party tool/library. Our goal is to only use JSF 2.0 functionality/feature.
In my project there is lot of use of
<a4j:jsFunction data="action" oncomplete="JavaScriptFunction(data); >
<a4j:actionaram name="nm" assignTo="#beanName.methodName"> </a4j:actionparam>
</a4j:jsFunction>
I want to remove this type of a4j:jsFunction with h:commandButton or
any jsf 2.0 standard mechanism.
I am not able to find out best way to call Bean function which return some value and assign this return value to JavaScript function.
JSF 1.3? I thought 1.2 was the latest?
On to your question. The idea to only use JSF 2.x is invalid and you should have the decision maker reconsider because skimping on OmniFaces will impede your productivity and the general code quality.
The way I see it you have three choices:
OmniFaces
Click button with display:none using javascript. Said button can have f:ajax as a child
Rip o:commandScript http://showcase.omnifaces.org/components/commandScript it's open source.
I can fully understand that a company today says no to Primefaces or Richfaces and honestly I would recommend it for many applications. Omnifaces however is to be seen as a proper for JSF.
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.
i have developed application with following facets
Dynamic Web Module 2.5
JavaServer Faces 1.2
Java 5
and i m using Rich Faces 3.2, Sever is Tomcat 6
i get an error
Attribute align invalid for tag panelGrid according to TLD.
i did followed the link
Layout out invalid according to TLD
but it didnt solve my problem since i m already using JSF 1.2. What could be the possible cause of this error. I can give following hints
the project was initially developed with no JavaServer Facet installed
i add JSF 1.2 and Rich faces (for some enhancement that i needed to be incorporated).
ever since then i started getting this error.
Thanks in Advance.
The other question is irrelevant. It's about the layout attribute while you're attempting to use the align attribute. The layout attribute of <h:panelGrid> was introduced in JSF 1.2. The align attribute was never supported by <h:panelGrid>. This attribute is not listed among the supported attributes of the <h:panelGrid> tag for JSF 1.2, as per its TLD documentation.
So, remove that align attribute and do whatever you're trying to do using CSS instead.
I'm using:
Tomcat 6.0
Jsf 1.2 - Mojarra Implementation
Tomahawk 1.1.9
I imported the taglib
<%# taglib uri="http://java.sun.com/jsp/jstl/functions" prefix="fn" %>
when i call:
<h:outputText value="#{fn:indexOf('ciao','i')}"></h:outputText>
Output is 1
when i use
<t:outputText value="#{fn:indexOf('ciao','i')}"></t:outputText>
it throws a server exception, like there are some problems referencing right library.
javax.el.ELException: Function 'fn:indexOf' not found
at org.apache.el.lang.ExpressionBuilder.visit(ExpressionBuilder.java:171)
at org.apache.el.parser.SimpleNode.accept(SimpleNode.java:145)
at org.apache.el.lang.ExpressionBuilder.prepare(ExpressionBuilder.java:133)
at org.apache.el.lang.ExpressionBuilder.build(ExpressionBuilder.java:147)
Any hint? Thank you everybody for help :)
I was able to reproduce exactly this problem with Mojarra 1.2_14 and Tomahawk 1.1.9 on Tomcat 6.0.18. The same problem also occurred at Tomcat 6.0.20, although the line numbers of the org.apache.el.* methods in the stacktrace were slightly different.
To exclude Tomcat's jsp-el from being suspect, I tested at Glassfish v3 as well, which is using a different EL impl. It produced basically the same exception, although with different EL classes in stacktrace (com.sun.el.* instead of org.apache.el.*).
Interesting fact is however that it indeed works flawlessly when using Facelets instead of JSP, as commented by Bozho. This would mean that the JSP EL implementations of both Tomcat and Glassfish are broken.
I would start filing an issue for Tomcat 6 here http://tomcat.apache.org/bugreport.html and see what the Apache guys says about this.