When I try to use <rich:columns> my data table is not getting rendered - jsf

I am not able to use <rich:columns> in my project. Following is my project config.
Dynamic Web module - 3.0
Java - 1.6
JavaScript - 1.0
JavaServer Faces - 2.0
I have the following RichFaces jar files.
richfaces-components-api-4.3.7.jar
richfaces-components-ui-4.3.7.jar
richfaces-core-api-4.3.7.jar
richfaces-core-impl-4.3.7.jar
In my Facelet I have the following code.
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:rich="http://richfaces.org/rich"
xmlns:c="http://java.sun.com/jsp/jstl/core"
xmlns:fn="http://java.sun.com/jsp/jstl/functions">
When I try to use <rich:columns> my data table is not getting rendered.
I'm not sure where I am missing.

Related

Why doesn't PrimeFaces contentFlow tag work?

I tried to use primeFaces contentFlow in jsf 2.3 but it doesn't load any images, just it shows me "loading"
the xhtml code is:
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:p="http://primefaces.org/ui"
xmlns:c="http://java.sun.com/jsp/jstl/core">
<h:head>
</h:head>
<h:body>
<p:contentFlow value="#{imagesView.images}" var="image">
<p:graphicImage name="demo/images/nature/#{image}" styleClass="content"/>
<div class="caption">#{image}</div>
</p:contentFlow>
...
and after render it appears so:
i tested it on primefaces versions 6.2 to 10. what can be the problem? does it need other libraries or extensions?

ui:include includes wrong file in JSF 2.2

Accorrding to the documentation of ui:include tag
Use this tag—which is very similar to JSP's jsp:include—to encapsulate
and reuse content among multiple XHTML pages. There are three things
this tag can include: plain XHTML, and XHTML pages that have either a
composition tag or a component tag.
You supply a filename, through ui:include's src attribute for JSF to
include. That filename is relative to the XHTML file that was rendered
as a result of the last request. So, for example, if JSF loaded the
view login.xhtml, and that file included pageDecorations/header.xhtml,
and pageDecorations/header.xhtml included companyLogo.xhtml, then
companyLogo.xhtml will not be found if it's in the pageDecorations
directory, because companyLogo.xhtml has to be in the same directory
as login.xhtml.
I created a simple test:
webapp/login.xhtml
<!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:ui="http://java.sun.com/jsf/facelets"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html">
<h:body>
<ui:include src="pageDecorations/header.xhtml" />
</h:body>
</html>
webapp/pageDecorations/header.xhtml
<ui:include
src="logo.xhtml"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets"
/>
webapp/pageDecorations/logo.xhtml
<h:outputText
value="Logo in /pageDecorations"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
/>
webapp/logo.xhtml
<h:outputText value="Logo in /"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
/>
When I ran this test (loaded login.xhtml page) using JSF 2.2 on WildFly 10.1 , I got Logo in /pageDecorations, while according to the documentation it should be: Logo in /
What is wrong ? Is there a bug in the documentation or Mojarra implementation ? Or my understanding is wrong ?
First, you are inside webapp/ and executing webapp/login.xhtml
inside that you get src="pageDecorations/header.xhtml" and for exectuing that you are in pageDecorations and from header.xhtml you are tring to find src="logo.xhtml" which will you get in the same directory (pageDecorations) so it will print
"Logo in /pageDecorations" .
Document looks wrong in this case.

Extract XML namespace declarations into separate tagfile/taglib

I would like to seperate my XML namespace declarations at the top of the page into a seperate (tag)file in which I can include in any Facelets page I wish.
Is this possible? Or do I need to copypaste all XML namespaces in each Facelets file?
Here's a theoretical example, xmlns.xhtml:
<something
xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:c="http://java.sun.com/jsp/jstl/core"
...
/>
And the template file which could use it: mypage.xhtml:
<f:view xmlns="xmlns.xhtml">
<h:head>
...
</h:head>
<h:body>
...
</h:body>
</f:view>
Nope, not possible. They must be present during XML compile time already.
Your best bet is creating or configuring XHTML template(s) in your IDE so that you can choose from them in New File without the need to copypaste/retype the boilerplate.
Here are some screens from Eclipse + JBoss Tools:

JSF/ Javascript error

I have developed a JSF 2.0 application in Netbeans IDE which is working correctly in my browser but when I deployed it on client side , it is giving me error: PRIMEFACES IS UNDEFINED
Does anyone have idea about the error? Any help will be highly appreciated. Thanks!
If you didnt have a head tag you will get that error.
You need to add the PrimeFaces namespace at the head tag.
xmlns:p="http://primefaces.org/ui"
Your xhtml page should like this-
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:p="http://primefaces.org/ui">
<h:head>
</h:head>
<h:body>
<p:spinner />
</h:body>
</html>
Please have a look at PrimeFAQ #2 and PrimeStartGuide.

When using MyFaces 2.1, with Eclipse Juno, how do I get rid of a space after the doctype

I have searched all around for an answer, and tried many things, but no luck. When I use MyFaces 2.1 with Eclipse Juno, and attempt to create an HTML5 page, I get
<!DOCTYTPE html >
Notice the space after the "html". When this page is viewed in FireFox, using HTML Tidy, it throws an error saying its an invalid doctype.
The source xhtml file contains with no space. Does anyone have a solution?
Thanks
Dan
I can reproduce it in at least MyFaces 2.1.9 and 2.1.10 (didn't tried older versions). This problem doesn't manifest in Mojarra. It's undoubtedly a bug in MyFaces. I recommend to report it to MyFaces guys.
For the meantime until they get it fixed, I found a workaround. Replace <!DOCTYPE>
<!DOCTYPE html>
<html lang="en"
xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
>
...
</html>
by <h:doctype>
<ui:composition
xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://java.sun.com/jsf/core"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:ui="http://java.sun.com/jsf/facelets"
>
<h:doctype rootElement="html" />
<html lang="en">
...
</html>
</ui:composition>
Its renderer generates the proper space-less doctype.
This problem is in no way related to Eclipse. It's just a tool like Notepad.

Resources