本文介绍了JSF:在我的应用程序中未引用javax.faces.resources的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Resources文件夹,这是我使用Chrome开发人员工具

Resources folder containing js and css file from javax.faces.resource is not referenced in my application, here is the front end errorlog that i get using Chrome developer tools

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?

Is there any particular configuration that we need to do so that javax.faces.resources are properly referenced in our application?

更新:添加了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页面.结果,所有资源请求都会重用该前缀:

You've got some mess with your URLs and servlet mappings. You have requested your JSF page with suffix .jsp. As a consequence all resource requests reuse this prefix:

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

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

我的猜测是您已经以某种方式将原始请求映射到Faces Servlet,但是随后的资源请求与映射模式不匹配.

My guess is you have somehow mapped the original request to the faces servlet but the subsequent resource requests fail to match the mapping pattern.

我建议两件事:不要将.jsp用作JSF页面请求的扩展.使它成为.jsf或其他未使用的东西.然后确保您已正确映射了servlet,并将此扩展名映射到face servlet:

I recommend two things: don't use .jsp as an extension for JSF page requests. Make it .jsf or something else unused. Then make sure you've got proper servlet mapping, mapping this extension to the faces servlet:

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

这篇关于JSF:在我的应用程序中未引用javax.faces.resources的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-19 01:20