在XHTML中使用IFrame时FacesFileNotFoundException

在第二个浏览器中使用IFRAME menuBar时,出现com.sun.faces.context.FacesFileNotFoundException。在XHTML中使用IFrame时FacesFileNotFoundException

我在使用其他浏览器时出现此错误。

HTTP Status 500 - 

type Exception report

message

description The server encountered an internal error() that prevented it from fulfilling this request.

-

exception

com.sun.faces.context.FacesFileNotFoundException: /xhtml/auth/faces/xhtml/client/clientImage.xhtml Not Found in ExternalContext as a Resource

com.sun.faces.facelets.impl.DefaultFaceletFactory.resolveURL(DefaultFaceletFactory.java:232)

com.sun.faces.facelets.impl.DefaultFaceletFactory.resolveURL(DefaultFaceletFactory.java:273)

com.sun.faces.facelets.impl.DefaultFaceletFactory.getMetadataFacelet(DefaultFaceletFactory.java:209)

com.sun.faces.application.view.ViewMetadataImpl.createMetadataView(ViewMetadataImpl.java:114)

com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:233)

com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)

com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:116)

com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)

javax.faces.webapp.FacesServlet.service(FacesServlet.java:593)

com.beo.importexport.filter.AuthFilter.doFilter(AuthFilter.java:64)

org.jboss.weld.servlet.ConversationPropagationFilter.doFilter(ConversationPropagationFilter.java:62)

note The full stack trace of the root cause is available in the JBoss Web/7.0.13.Final logs.

JBoss Web/7.0.13.Final:

我在一个XHTML页面中使用了templage。 在模板内部使用IFrame。

iframe由带有一些菜单项的菜单栏组成。

我的问题是,当登录到第二个Web浏览器时,会话发生变化,因此IFRAME中的SRC将前缀到hardcorded路径的较早路径。

下面

 <iframe name="contentframe" id="contentframe" 

width="100%" height="710px"

src="faces/xhtml/client/clientImage.xhtml"

scrolling="auto"

style="overflow: auto;" >

</iframe>

我的IFRAME SRC标签为什么这个路径前缀发生在IFRAME SRC?

回答:

这是因为您的<iframe src>表示相对URL。它不以该方案开始(例如,http://,https://等),也不以斜杠(/)开头。相对URL是相对于当前请求URL进行解释的(在浏览器的地址栏中看到的;请注意:因此不适用于服务器磁盘文件系统中的物理文件位置,因为许多启动程序错误地认为该位置)。

所以,如果请求的URL(猜测/faces是上下文路径,你不就清楚了,你告诉一无所知上下文路径也没有实际的请求URL也不是JSF映射)例如,

http://example.com/faces/xhtml/auth/login.xhtml

那么相对URL faces/xhtml/client/clientImage.xhtml将被搜索在当前请求URL的相同的文件夹,从而导致此URL:

http://example.com/faces/xhtml/auth/faces/xhtml/client/clientImage.xhtml

虽然仍然asusming是/faces是上下文路径,那么这将产生正是你得到了异常:你也完全iframe的文件是什么网址不明确

com.sun.faces.context.FacesFileNotFoundException: /xhtml/auth/faces/xhtml/client/clientImage.xhtml Not Found in ExternalContext as a Resource 

可用。基于迄今为止提供的资料,我最好的猜测是

http://example.com/faces/xhtml/client/clientImage.xhtml

如果事实确实如此,那么你实际上应使用

<iframe src="/faces/xhtml/client/clientImage.xhtml" /> 

的斜线/会无论当前的请求URL如何,都要将其解释为相对于域根。

以上是 在XHTML中使用IFrame时FacesFileNotFoundException 的全部内容, 来源链接: utcz.com/qa/263538.html

回到顶部