gpt4 book ai didi

java - JSF 1.2 + JBoss 5 不渲染 jsf 标签。

转载 作者:行者123 更新时间:2023-12-02 00:06:02 26 4
gpt4 key购买 nike

我正在尝试将 .net 应用程序转换为 JSF 1.2 以位于我们的旧版 JBoss 服务器上,但我无法渲染 jsf 标签。在我的浏览器中我看到的正是我在 Eclipse 中看到的。

如有任何建议,我们将不胜感激。

web.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5">
<display-name>WebDataViewer</display-name>

<context-param>
<param-name>javax.faces.FACELETS_LIBRARIES</param-name>
<param-value>/WEB-INF/tlds/formatter-taglib.xml</param-value>
</context-param>

<!-- JSF -->
<context-param>
<param-name>javax.faces.CONFIG_FILES</param-name>
<param-value>/WEB-INF/faces-config.xml</param-value>
</context-param>

<context-param>
<param-name>javax.faces.DEFAULT_SUFFIX</param-name>
<param-value>.xhtml</param-value>
</context-param>

<context-param>
<param-name>javax.faces.STATE_SAVING_METHOD</param-name>
<param-value>server</param-value>
</context-param>

<context-param>
<param-name>facelets.VIEW_MAPPINGS</param-name>
<param-value>*.xhtml</param-value>
</context-param>

<context-param>
<param-name>org.ajax4jsf.VIEW_HANDLERS</param-name>
<param-value>com.sun.facelets.FaceletViewHandler</param-value>
</context-param>

<context-param>
<param-name>org.richfaces.SKIN</param-name>
<param-value>CLASSIC</param-value>
</context-param>

<listener>
<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>

<!-- Allows you to put html comments in your views without the compiler blowing up -->
<context-param>
<param-name>javax.faces.FACELETS_SKIP_COMMENTS</param-name>
<param-value>true</param-value>
</context-param>

<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>*.jsf</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>

<welcome-file-list>
<welcome-file>index.xhtml</welcome-file>
</welcome-file-list>
</web-app>

faces-config.xml

<?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_1_2.xsd"
version="1.2">

<application>
<view-handler>org.ajax4jsf.application.AjaxViewHandler</view-handler>
</application>

<!-- Backing Beans -->
<managed-bean>
<managed-bean-name>tableBacking</managed-bean-name>
<managed-bean-class>edu.mayo.ccs.webdataviewer.ui.backing.TableLookupBacking</managed-bean-class>
<managed-bean-scope>session</managed-bean-scope>
</managed-bean>

</faces-config>

index.xhtml

<!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"
xmlns:rich="http://richfaces.org/rich"
xmlns:a4j="http://richfaces.org/a4j"
xmlns:ui="http://java.sun.com/jsf/facelets">

<ui:composition template="/template.xhtml">

<ui:define name="title">Web Data Viewer</ui:define>

<ui:define name="centerColumn">
<h1>Web Data Viewer</h1>
</ui:define>

</ui:composition>
</html>

最佳答案

根据评论,您在按照自己的方式配置 Facelets 1.x 时遇到以下异常 docbook :

cannot find fully qualified class: com.sun.facelets.FaceletViewHandler

显然,JBoss 5.x 并未附带 Facelets 1.x(可能非常好,因为它不是标准 Java EE 5 的一部分)。您需要自己在 web 应用程序的 /WEB-INF/lib 中提供它。您可以从 Maven 存储库等获取它 here 。这是 jsf-facelets.jar 文件。

请注意,JSF 2.x 不需要此文件,因为 Facelets 库捆绑在 JSF JAR 本身中。

关于java - JSF 1.2 + JBoss 5 不渲染 jsf 标签。,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13866006/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com