我一直在尝试使用 BootsFaces。我已确保满足以下要求:
- Java EE 1.6 以上
- jsf-api和jsf-impl 2.2以上的JAR文件
- MyFaces api 和 impl 2.2 以上的 JAR 文件
- BootsFaces 0.7.0 JAR 文件
此外,我还按照 BootsFaces 文档中列出的正确渲染步骤(更改 web.xml 和 faces-config 文件)
我创建了一个示例 jsf(中)文件并尝试运行它。
我有一个错误说
javax.servlet.ServletException: Error loading theme, cannot find "css/theme.css" resource of "bsf" library
javax.faces.webapp.FacesServlet.service(FacesServlet.java:321)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
*项目结构
Faces-config.xml
<?xml version="1.0" encoding="UTF-8"?>
<faces-config
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-facesconfig_2_2.xsd"
version="2.2">
<application>
<resource-handler>net.bootsfaces.render.UnmappedResourceHandler</resource-handler>
</application>
</faces-config>
网页.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"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
id="WebApp_ID"
version="3.0">
<context-param>
<param-name>BootsFaces_USETHEME</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>
<url-pattern>/javax.faces.resource/*</url-pattern>
</servlet-mapping>
</web-app>
中.jsf
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:b="http://bootsfaces.net/ui" xmlns:f="http://java.sun.com/jsf/core">
<h:head />
<h:body>
<b:container>
<b:row>
<b:column span="8">
<b:panel look="primary" title="b:column span='8'">
Eight columns on medium screens (e.g. small desktop and notebook screens).<br /> Stacked on screens smaller than 992 pixels width.
<br />
</b:panel>
</b:column>
</b:row>
</b:container>
</h:body>