我使用的是ice faces 1.8应用程序示例。
pom为:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>groupId</groupId>
<artifactId>tab</artifactId>
<version>1.0-SNAPSHOT</version>
<dependencies>
<dependency>
<groupId>org.icefaces.netbeans.rave</groupId>
<artifactId>wyswyg-appbase</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>javax.el</groupId>
<artifactId>el-api</artifactId>
<version>1.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.icefaces</groupId>
<artifactId>just-ice</artifactId>
<version>1.8.2</version>
</dependency>
<dependency>
<groupId>org.icefaces</groupId>
<artifactId>icefaces-comps</artifactId>
<version>1.8.2</version>
<exclusions>
<exclusion>
<groupId>org.icefaces</groupId>
<artifactId>icefaces</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.icefaces</groupId>
<artifactId>icefaces-facelets</artifactId>
<version>1.8.2</version>
<exclusions>
<exclusion>
<groupId>org.icefaces</groupId>
<artifactId>icefaces</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.sun.facelets</groupId>
<artifactId>jsf-facelets</artifactId>
<version>1.1.14</version>
</dependency>
</dependencies>
</project>
web.xml是:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd"
version="3.1">
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
</web-app>
faces-config.xml为空:
如果我把这个放在上面
<application>
<view-handler>com.icesoft.faces.facelets.D2DFaceletViewHandler</view-handler>
</application>
应用程序抛出此异常:
java.lang.RuntimeException: com.sun.faces.config.ConfigurationException:无法创建'com.icesoft.faces.facelets.D2DFaceletViewHandler的新实例
<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
"http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
</faces-config>
index.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:h="http://java.sun.com/jsf/html"
xmlns:f="http://xmlns.jcp.org/jsf/core" xmlns:ace="http://www.icesoft.com/icefaces/component"
xmlns:ice="http://www.icesoft.com/icefaces/component"
>
<h:form>
<h:outputLabel value="Hello, world"/>
<ice:outputText value="hello world ice outputtext"/>
</h:form>
</html>
问题是,当我运行它并生成xhtml时,只呈现h标记"Hello,world“。没有呈现ice faces标记(ice:outputText),因为在xhtml代码中,它仍然是原样。

在过去的4天里,我尝试了我在网上找到的每一个张贴的解决方案,但都没有对我起作用。
我尝试过ICEFaces 3.x、不同的名称空间、Tomcat6/7等
我使用的是Intellij 14和Tomcat 6.0.44
请让我知道,如果有人发现我做错了什么/丢失了什么,如果你需要我的应用程序/环境中的任何其他信息。
非常感谢!
发布于 2016-04-03 01:41:52
我想要做的是使用(当然也是渲染)一个复合组件。
我最终使用复合组件的模板解决了这个问题:
这是template.xhtml上的结构
<h:head>
...
</h:head>
<h:body>
<div class="[name1]">
<h:form>
<ui:insert name="[name2]"/>
</h:form>
</div>
</h:body>
并在主窗体中使用它,如下所示:
<ui:composition ...
xmlns:composite="http://java.sun.com/jsf/composite/componentes"
template="/WEB-INF/templates/template.xhtml">
<ui:define name="name2">
<ice:[any ice component]>
</ice:[any ice component]>
</ui:define>
可能在模板中的表单标签是不必要的,甚至模板也不是,但在几个小时和几个小时的网上冲浪这是我解决的方式。
如果需要更多的细节,尽管问吧。或者如果有人有更好的方法来做这件事,将是非常欢迎的。
致以问候!
https://stackoverflow.com/questions/36336194
复制相似问题