gpt4 book ai didi

java - JSF:我的应用程序中未引用 javax.faces.resources

转载 作者:行者123 更新时间:2023-12-01 15:26:25 25 4
gpt4 key购买 nike

我的应用程序中未引用包含 javax.faces.resource 中的 jscss 文件的

Resources 文件夹,这是我使用 Chrome 开发者工具得到的前端错误日志

GET http://demo:2008/javax.faces.resource/themes/sam/theme.css.jsp?ln=icefaces.ace 404 (Not Found)
JobImport.jsp:246GET http://demo:2008/javax.faces.resource/util/ace-components.js.jsp?ln=icefaces.ace 404 (Not Found)
JobImport.jsp:246GET http://demo:2008/javax.faces.resource/yui/yui-min.js.jsp?ln=yui/3_1_1&v=3068887 404 (Not Found)
JobImport.jsp:246GET http://demo:2008/javax.faces.resource/util/combined.css.jsp?ln=icefaces.ace 404 (Not Found)
JobImport.jsp:246GET http://demo:2008/javax.faces.resource/loader/loader-min.js.jsp?ln=yui/3_1_1&v=3068887 404 (Not Found)
JobImport.jsp:246GET http://demo:2008/javax.faces.resource/util/ace-jquery.js.jsp?ln=icefaces.ace 404 (Not Found)
JobImport.jsp:246GET http://demo:2008/javax.faces.resource/yui2-skin-sam-button/assets/button-core.css.jsp?ln=yui/2in3 404 (Not Found)
JobImport.jsp:246GET http://demo:2008/javax.faces.resource/combined.js.jsp?ln=org.icefaces.component.util&v=3068887 404 (Not Found)
JobImport.jsp:246GET http://demo:2008/javax.faces.resource/yui2-skin-sam-tabview/assets/tabview-core.css.jsp?ln=yui/2in3 404 (Not Found)
JobImport.jsp:246GET http://demo:2008/javax.faces.resource/combined.css.jsp?ln=org.icefaces.component.util 404 (Not Found)
JobImport.jsp:246GET http://demo:2008/javax.faces.resource/fileEntry.js.jsp?ln=org.icefaces.component.fileentry&v=3068887 404 (Not Found)
JobImport.jsp:246GET http://demo:2008/javax.faces.resource/slider/assets/slider-core.css.jsp?ln=yui/3_1_1 404 (Not Found)
JobImport.jsp:246GET http://demo:2008/javax.faces.resource/bridge.js.jsp?v=3068887 404 (Not Found)
JobImport.jsp:246GET http://demo:2008/javax.faces.resource/icefaces-compat.js.jsp 404 (Not Found)
JobImport.jsp:246GET http://demo:2008/javax.faces.resource/compat.js.jsp 404 (Not Found)
JobImport.jsp:246GET http://demo:2008/javax.faces.resource/jsf.js.jsp?ln=javax.faces&v=3068887 404 (Not Found)
JobImport.jsp:249Uncaught ReferenceError: ice is not defined
(anonymous function)JobImport.jsp:249
JobImport.jsp:250Uncaught ReferenceError: ice is not defined
(anonymous function)JobImport.jsp:250
JobImport.jsp:253Uncaught ReferenceError: ice is not defined
JobImport.jsp:254Uncaught ReferenceError: ice is not defined

我们需要执行任何特定配置才能在我们的应用程序中正确引用 javax.faces.resources 吗?

更新:添加了 jsp、xhtml 和 web.xml 文件

这是我的 jsp 页面

    <html>
<head>
<!-- BEGIN SCRIPT TO OPEN RIGHT NOW HELP POPUP, THIS SCRIPT INCLUDES THE FUNCTION OPENRN-->
<%@ include file="/js/popupRightNow.inc" %>

<!-- END SCRIPT TO OPEN RIGHT NOW HELP POPUP, THIS SCRIPT INCLUDES THE FUNCTION OPENRN-->
<title>Test</title>

<META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
</head>
<body>
<jsp:include page="/navigation/TopNav.jsp" flush="true"/>

<jsp:include page="/entry/Upload.xhtml"/>


<!--BEGIN BOTTOM NAV -->
<jsp:include page="/navigation/BottomNav.jsp" flush="true"/>
<!--END BOTTOM NAV -->
</body>
</html>

这是我的 xhtml 页面:

<?xml version='1.0' encoding='UTF-8' ?>

<h:head>
<title>ICEfaces 3</title>
<!-- <link rel="stylesheet" type="text/css" href="/xmlhttp/css/rime/rime.css"/> -->
</h:head>
<h:body>
<h:form id="form">
<h:outputText value="Welcome to ICEfaces 3, select current date: "/>
<ace:dateTimeEntry renderAsPopup="true">
<f:convertDateTime pattern="MM/dd/yyyy" timeZone="Canada/Mountain"/>
</ace:dateTimeEntry>
<ace:fileEntry id = "fileUpload"
label="File Entry"
relativePath="uploaded"
fileEntryListener="#{fileUpload.uploadFile}"/>
<h:commandButton value="Upload File" />
</h:form>
</h:body>

这是我的web.xml

 <?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">

<web-app >
<context-param>
<param-name>javax.faces.FACELETS_SKIP_COMMENTS</param-name>
<param-value>true</param-value>
</context-param>

<context-param>
<param-name>javax.faces.VALIDATE_EMPTY_FIELDS</param-name>
<param-value>false</param-value>
</context-param>

<context-param>
<param-name>com.icesoft.faces.concurrentDOMViews</param-name>
<param-value>false</param-value>
</context-param>

<context-param>
<param-name>com.icesoft.faces.synchronousUpdate</param-name>
<param-value>false</param-value>
</context-param>

<context-param>
<param-name>com.icesoft.faces.blockingRequestHandler</param-name>
<param-value>icefaces</param-value>
</context-param>

<context-param>
<param-name>com.icesoft.faces.checkJavaScript</param-name>
<param-value>false</param-value>
</context-param>

<!-- filters.xml : Non-XDoclet filter declarations, merged into web.xml by XDoclet. -->



<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>

<servlet-mapping>
<servlet-name>Resource Servlet</servlet-name>
<url-pattern>/xmlhttp/*</url-pattern>
</servlet-mapping>


</web-app>

最佳答案

您的 URL 和 servlet 映射有些困惑。您已请求带有后缀 .jsp 的 JSF 页面。因此,所有资源请求都重用此前缀:

获取http://demo:2008/javax.faces.resource/util/ace-components.js .jsp?ln=icefaces.ace

我的猜测是您已以某种方式将原始请求映射到 faces servlet,但后续资源请求无法匹配映射模式。

我建议两件事:不要使用 .jsp 作为 JSF 页面请求的扩展名。将其设为 .jsf 或其他未使用的文件。然后确保您有正确的 servlet 映射,将此扩展映射到 faces servlet:

<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>

关于java - JSF:我的应用程序中未引用 javax.faces.resources,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10078330/

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