ICEfaces configured for view, but h:head and h:body components are required - icefaces

i am trying to use icefaces 3, and configuring the rime theme as follows:
org.icefaces.ace.theme
rime
but i am getting the following warning:
Mar 19, 2012 4:57:04 PM org.icefaces.impl.event.BridgeSetup isListenerForSource
WARNING: ICEfaces configured for view /xmlhttp/css/rime/css-images/bullet.gif but h:head and h:body components are required
please advise.

This just means that you are loading a page that does not have <h:head> nor <h:body> defined. Do it this way:
<?xml version="1.0" encoding="UTF-8"?>
<!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:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
xmlns:ace="http://www.icefaces.org/icefaces/components"
xmlns:ice="http://www.icesoft.com/icefaces/component">
<h:head>
<title>MyPage</title>
</h:head>
<h:body>
<!-- put your icefaces stuff in here -->
</h:body>
</html>

Related

Lombok in Eclipse Neon

I would like to use lombok 1.16.10 in Eclipse Neon in an EE project. When I create the simplest managed bean:
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import lombok.Getter;
import lombok.Setter;
#ManagedBean
#SessionScoped
class IndexBean
{
#Getter
#Setter
private String name;
}
And I refer to it in the simplest JSP page:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<%# page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!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:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Insert title here</title>
</head>
<body>
<f:view>
<h:form>
<h:inputText value="#{indexBean.name}"> </h:inputText>
</h:form>
</f:view>
</body>
</html>
The compiler can not see the IndexBean.name field in the JSP. If I write the accessors manually, there is no problem (the lombok.jar is in the classpath of the project). What I missed?
Another questions:
Is there any way to create a JSF facelets instead of a JSP pages in Eclipse? This is an old fashioned and hard to maintain form.
How can I set that the code generation prefer the annotations against the dependencies? When I create a managed bean it does not contain the annotations.
All of this is working in NetBeans like a charm!

JSF 2 template itself shows style, but template client shows plain text without style

I am trying to use JSF Facelet template/Facelet template client first time. I am creating template and template client with Netbeans 7.2.1. When I run that created JSF project and call http://localhost:8080/jpaweb/template.xhtml I can see template style, but when I call client template http://localhost:8080/jpaweb/client.xhtml I see plain text without style. Both files are in the same directory and created by Netbeans wizard. Please, help me with this issue.
template.xhtml
<?xml version='1.0' encoding='UTF-8' ?>
<!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:h="http://java.sun.com/jsf/html">
<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link href="./resources/css/default.css" rel="stylesheet" type="text/css" />
<link href="./resources/css/cssLayout.css" rel="stylesheet" type="text/css" />
<title>Facelets Template</title>
</h:head>
<h:body>
<div id="top" class="top">
<ui:insert name="top">Top</ui:insert>
</div>
<div>
<div id="left">
<ui:insert name="left">Left</ui:insert>
</div>
<div id="content" class="left_content">
<ui:insert name="content">Content</ui:insert>
</div>
</div>
</h:body>
</html>
client.xhtml
<?xml version='1.0' encoding='UTF-8' ?>
<!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">
<body>
<ui:composition template="./template.xhtml">
<ui:define name="top">
Welcome, to my website
</ui:define>
<ui:define name="left">
My links
</ui:define>
<ui:define name="content">
This page is created for testing
</ui:define>
</ui:composition>
</body>
</html>
If you have Netbeans creating JSF project and JSF template and template client will get you this result. I tried in Netbeans 1.7.0 also. Same problem.
Edit: I run page not like http://localhost:8080/jpaweb/client.xhtml but likehttp://localhost:8080/jpaweb/faces/client.xhtml it worked. There is no "faces" directory in my project. Do we have to add "faces" to all JSF links?
Edit 2: I think netbeans auto-configures that all jsf files are kept in faces directory even there is no such directory in my project. And in Project properties -> Frameworks -> JavaServer Faces -> Configuration there is field JSF Servlet URL Pattern with value assigned /faces/*. I think that means one must call jsf files as if it is in faces directory. Trying to force it work as it appears in my project was a mistake :)
Solved. Changed value of Project properties -> Frameworks -> JavaServer Faces -> Configuration -> JSF Servlet URL Pattern from /faces/* to *.xhtml, and that worked OK.
Your client.xhtml content file is not properly composed. Don't include html tags, as JSF doesn't parse anything out from ui:composition tags here.
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets"
template="./template.xhtml">
<ui:define name="top">
Welcome, to my website
</ui:define>
<ui:define name="left">
My links
</ui:define>
<ui:define name="content">
This page is created for testing
</ui:define>
</ui:composition>
I tested with your template and it works.

Why Facelet HTML Validator validate my xhtml file don't complete

I have 1 file xthml as the following:
<?xml version="1.0" encoding="UTF-8"?>
<ui:composition 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"
xmlns:p="http://primefaces.org/ui"
template="/WEB-INF/templates/default.xhtml">
<ui:define name="content">
.......
</ui:define>
</ui:composition>
After restart my eclipse 3.7, Eclipse perform validation but it always run :
"Facelet HTML validator starting to validate: student.xhtml".
If I disable Facelet validation in Windows - Preference, when I perform Ctrl + Space in this xhtml file, eclipse will be not responding. What do I have to do to fix this? Thanks.

show jsf component in xhtml page

i have a dynamic web application in eclipse using jsf . i created a jsp page with 'new java server faces(jsf) page(xhtml)' template and want to show just a h:inputText but when i run my app in tomcat the inputText doesn't show up .
when i use 'new java server faces(jsf) page(html)' template i wont have any problem but i have to use xhtml in my project .
i'm using eclipse indigo sr2 3.7.2 - myfaces 2.0.14 - tomcat 7.0.29
my jars : commons-beanutils-1.8.3 - commons-codec-1.3 - commons-collections-3.2 - commons-digester-1.8 - commons-logging-1.1.1 - jstl-api-1.2 - jstl-impl-1.2 - myfaces-api-2.0.14 - myfaces-bundle-2.0.14 - myfaces-impl-2.0.14
main.jsp :
<?xml version="1.0" encoding="ISO-8859-1" ?>
<%# page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!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:f="http://java.sun.com/jsf/core" xmlns:h="http://java.sun.com/jsf/html">
<h:head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<title>Insert title here</title>
</h:head>
<h:body>
<f:view>
<h1>JSF XHTML</h1>
<h:inputText value="Hi"></h:inputText>
</f:view>
</h:body>
</html>
what's the problem ?
i changed main.jsp to main.xhtml and added these lines to my web.xml and now my project working fine .
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
thanx for your attention

Enabling ICEfaces compat leads to not recognizing h:head and h:body

I'm working on an ICEfaces 3 application and I have the following XHTML file:
<?xml version='1.0' encoding='UTF-8' ?>
<!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"
xmlns:ice="http://www.icesoft.com/icefaces/component"
xmlns:icecore="http://www.icefaces.org/icefaces/core"
xmlns:ace="http://www.icefaces.org/icefaces/components"
>
<h:head></h:head>
<h:body>
<ui:composition template="template/main-template.xhtml"> ... </ui:composition>
</h:body>
</html>
Using this template without icefaces-compat included in the WAR works well (as long as I only use ACE components obviously). But now I like to use some of the ice: components and therefore need the -compat JAR. But when adding this JAR to the WAR the following error occurs:
12.04.2012 13:56:32 org.icefaces.impl.event.BridgeSetup isListenerForSource
WARNING: ICEfaces configured for view /configuration.xhtml but h:head and h:body components are required
This error also occurs when I completely remove the ui:composition tag from the side, i.e. the <h:body> tag is empty.
I'm happy to provide further information but right now I'm not sure what is important as the only difference that I do is that I add the -compat library to the WAR.
I finally came up with the very simple solution: I forgot to add the WEB-INF/faces-config.xml file. This seems to be fine as long as ACE etc is used, but as soon as the -compat jars are used, it seems to be necessary. The file itself needs to only include:
<?xml version="1.0" encoding="UTF-8"?>
<faces-config 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-facesconfig_2_0.xsd"
version="2.0">
</faces-config>