首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >ICEFaces标记不能在xhtml中呈现(JSF2.2和ICEFaces 3.3.0)

ICEFaces标记不能在xhtml中呈现(JSF2.2和ICEFaces 3.3.0)
EN

Stack Overflow用户
提问于 2016-03-31 22:24:57
回答 1查看 734关注 0票数 1

我使用的是ice faces 1.8应用程序示例。

pom为:

代码语言:javascript
复制
<?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是:

代码语言:javascript
复制
<?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为空:

如果我把这个放在上面

代码语言:javascript
复制
    <application>
        <view-handler>com.icesoft.faces.facelets.D2DFaceletViewHandler</view-handler>

    </application>

应用程序抛出此异常:

java.lang.RuntimeException: com.sun.faces.config.ConfigurationException:无法创建'com.icesoft.faces.facelets.D2DFaceletViewHandler的新实例

代码语言:javascript
复制
<?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是:

代码语言:javascript
复制
<?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

请让我知道,如果有人发现我做错了什么/丢失了什么,如果你需要我的应用程序/环境中的任何其他信息。

非常感谢!

EN

回答 1

Stack Overflow用户

发布于 2016-04-03 01:41:52

我想要做的是使用(当然也是渲染)一个复合组件。

我最终使用复合组件的模板解决了这个问题:

这是template.xhtml上的结构

代码语言:javascript
复制
<h:head>
  ...
</h:head>

<h:body>
  <div class="[name1]">
    <h:form>
      <ui:insert name="[name2]"/>
    </h:form>
  </div>
</h:body>

并在主窗体中使用它,如下所示:

代码语言:javascript
复制
<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>

可能在模板中的表单标签是不必要的,甚至模板也不是,但在几个小时和几个小时的网上冲浪这是我解决的方式。

如果需要更多的细节,尽管问吧。或者如果有人有更好的方法来做这件事,将是非常欢迎的。

致以问候!

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/36336194

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档