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

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>

Related

In dita-ot is it possible to integrate into a feature extension for a specific transtype only?

Specifically, I have a custom dita-ot xhtml plugin which uses the <feature extension="dita.xsl.xhtml" file="xsl/header.xsl"/> to integrate into the xhtml pipeline. But this extension is used by the default xhtml output as well. I don't want this. Is there a way to run my extensions only for my own plugin?
A small example (brandheader example from the dita-ot documentation) which demonstrates the described behavior:
plugin.xml:
<?xml version="1.0" encoding="UTF-8"?>
<plugin id="com.example.brandheader">
<feature extension="ant.import" file="build.xml" />
<feature extension="dita.xsl.xhtml" file="xsl/header.xsl"/>
<transtype name="xhtml-extension" />
</plugin>
build.xml:
<?xml version="1.0" encoding="UTF-8"?>
<project name="com.example.xhtml.extension" basedir=".">
<target name="dita2xhtml-extension" depends="dita2xhtml"/>
</project>
header.xsl:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template name="gen-user-header">
<div>
<img src="https://www.dita-ot.org/images/dita-ot-logo.svg" alt="Example Company Banner"/>
</div>
</xsl:template>
</xsl:stylesheet>
The customized header appears for the xhtml transtype as well as for the xhtml-extension transtype.
I searched on stackoverflow for a similar question and I read the dita-ot developer documentation. But I couldn't find an option to enable the extension only for my plugin.
I am happy about any input.
Another option is to override the main XSLT used for processing in your custom XHTML plugin's build file:
<target name="dita2xhtml-custom"
depends="dita2xhtml-custom.init,
dita2xhtml"/>
<target name="dita2xhtml-custom.init">
<property name="args.xsl"
location="${dita.plugin.com.example.xhtml-custom.dir}/custom-main.xsl"/>
</target>
and your custom-main.xsl would import the xhtml XSLT stylesheet like:
<xsl:import href="plugin:org.dita.xhtml:xsl/dita2xhtml.xsl"/>
and add your own templates to the custom-main.xsl to override templates in the dita2xhtml.xsl.
Your "header.xsl" XSLT stylesheet will indeed be taken into account for any transformation type extended from the base XHTML one.
But what you could do would be to define in your plugin.xml an extension point with the name dita.conductor.xhtml.param:
https://www.dita-ot.org/dev/extension-points/all-extension-points.html#all-extension-points__dita.conductor.xhtml.param
Something like this:
<feature extension="dita.conductor.xhtml.param" value="params.xml" type="file"/>
and the params.xml file could contain:
Then in your XSLT stylesheet you define a global xsl:param named "TRANSTYPE" and you should receive on it the value of the transtype from the DITA OT build files, making it possible to take decisions in the custom XSLT templates based on the current transformation type.

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

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

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>

No tag "link" defined in tag library imported with prefix "h" | tomcat | eclipse

I was working in Netbeans IDE and switched to Eclipse.
I created a simple JSF 2.0 based using wizard in eclipse. The complete file is this.
index.jsp
<%# page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<%# taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%# taglib prefix="h" uri="http://java.sun.com/jsf/html"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<f:view>
<h1>Hi, This is my JSF 2. Applicaiton</h1>
<br />
Click <h:link outcome="UserLogin">here</h:link> to go to login
</f:view>
</body>
</html>
When I deploted this app in tomcat 7.0 server, I am getting the following error message,
org.apache.jasper.JasperException: /index.jsp(14,6) No tag "link" defined in tag library imported with prefix "h"
In my IDE also I can see the
Help appreciated.
The <h:link> was new in JSF 2.0 and didn't exist in JSF 1.x. This error can thus have the following causes:
You've actually JSF 1.x libraries in your /WEB-INF/lib, not JSF 2.0 libraries.
Your faces-config.xml is declared as JSF 1.x instead of JSF 2.0. Ensure that it is declared conform JSF 2.0 spec.
<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">
A few quick questions:
Where is your JSF library located?
I think you meant more after:In my
IDE also I can see the which leads
into.
Eclipse is usually pretty good
at being able to find your tag
libraries. Is it complaining about
the use of these libraries in your
jsp editor page?
Let us know some more info about your setup first.
I'll throw out the obvious solution: You've lost the reference to your JSF jar(jsf-impl.jar). Including it in your Tomcat lib folder should fix it.
I'm in the middle of this problem too, I would like to find some solution, but I don't manage. As I found you are at the same step like me.
If you use facelets then you are able to see that tag, instead if you use normal "JSF" it gives the error as you mentioned.
You could try this procedure to solve your problem.
Try to understand how to configure facelets on your web app. For example for my webapp files that ends with *.xhtml are processed by facelets engine.
Rename file to *.xhtml.
Prepend this
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
and
<html
xmlns="http://www.w3.org/1999/xhtml"
xmlns:ui="http://java.sun.com/jsf/facelets">
instead of normal html.
Remove any of the directive
<%# taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%# taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
Detailed instructions can be found here: http://wiki.apache.org/myfaces/MigrateFromJspToFacelets
Then you should be able to process h:link.