【问题标题】:ICEFaces tag not rendering in xhtml (JSF 2.2 and ICEFaces 3.3.0)ICEFaces 标记未在 xhtml 中呈现(JSF 2.2 和 ICEFaces 3.3.0)
【发布时间】:2016-07-20 01:43:17
【问题描述】:

我正在使用 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:outputText) 未呈现,因为在 xhtml 代码中,它仍然是原样。


我尝试了过去 4 天在网上找到的所有发布的解决方案,但对我没有任何帮助。

我尝试了 ICEFaces 3.x、不同的名称空间、tomcat 6/7 等

我正在使用 Intellij 14 和 Tomcat 6.0.44

请告诉我,如果有人发现我做错了/遗漏了什么,以及您是否需要我的应用/环境中的任何其他信息。

非常感谢!

【问题讨论】:

    标签: xhtml icefaces


    【解决方案1】:

    我试图做的是使用(当然是渲染)一个复合组件。

    我终于解决了使用复合组件的模板:
    这是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>

    可能是模板中的表单标签不是必需的,甚至模板也不是,在网上冲浪几个小时后萌芽这是我解决的方法。

    需要任何进一步的细节,尽管问。或者如果有人有更好的方法来做到这一点,将非常欢迎。

    问候!

    【讨论】:

      猜你喜欢
      • 2021-01-30
      • 1970-01-01
      • 2011-12-19
      • 2013-09-13
      • 2011-06-22
      • 1970-01-01
      • 2012-10-13
      • 2011-07-22
      • 2011-07-07
      相关资源
      最近更新 更多