2012-05-21 24 views
2

我在NetBeans 7.1.2中看到兩個類似的頁面,一個名爲index.xhtml,另一個名爲index_old.xhtml,都在Web Pages根目錄中。Glassfish 3.1.2 Faces Servlet xhtml處理不當/丟失輸出

index.xhtml正確處理並具有正確的輸出。

index_old.xhtml似乎只顯示硬編碼文本,沒有別的。

當的index.xhtml - > index_older.xhtml & index_old.xhtml - >的index.xhtml則以前不正常index_old.xhtml現在顯示正確的輸出&的以前正確地工作現在的index.xhtml不顯示正確的輸出。

這是怎麼發生的?這個問題如何解決?

以下是我的索引文件:

的index.xhtml:

<?xml version='1.0' encoding='UTF-8' ?> 
<!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:h="http://java.sun.com/jsf/html"> 
<h:head> 
<title>Development Environment - THIS SITE IS A LIVE VIEW OF A WORK IN PROGRESS</title> 
<h:outputStylesheet name="css/jsfcrud.css"/> 
</h:head> 
<h:body> 
<h:graphicImage id="logo" value="/images/logo.PNG" width="256" height="55" /> 
<br /> 
<br /> 
Development Environment - THIS SITE IS A LIVE VIEW OF A WORK IN PROGRESS. 
<br /> 
<br /> 
This is a live, fully functioning dynamic web site for the migration of the Service and Naming Standards Inventory workbook to 
a web enabled, database hosted application.<br /> It's purpose is to allow for testing and development of expected functionality before 
the application is deployed to a production server.<br /> 
<br /> 
For feature requests, change requests, and bug reports, please send a detailed email to 
<br /> 
<br /> 
<a href="/SNSI/secureNOC/indexSecure.xhtml">NOC personnel log in here</a> 
<br /> 
<br /> 
<a href="/SNSI/secureBasic/indexBasic.xhtml">Other authorized personnel log in here</a> 
</h:body> 
</html> 

index_old.xhtml:

<?xml version='1.0' encoding='UTF-8' ?> 
<!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:h="http://java.sun.com/jsf/html"> 
<h:head> 
<title>Development Environment - THIS SITE IS A LIVE VIEW OF A WORK IN PROGRESS</title> 
<h:outputStylesheet name="css/jsfcrud.css"/> 
</h:head> 
<h:body> 
<h:graphicImage id="logo" value="/images/logo.PNG" width="256" height="55" /> 
<br /> 
<br /> 
Development Environment - THIS SITE IS A LIVE VIEW OF A WORK IN PROGRESS. 
<br /> 
<br /> 
This is a live, fully functioning dynamic web site for the migration of the Service and Naming Standards Inventory workbook to 
a web enabled, database hosted application.<br /> It's purpose is to allow for testing and development of expected functionality before 
the application is deployed to a production server.<br /> 
<br /> 
For feature requests, change requests, and bug reports, please send a detailed email to 
<br /> 
<br /> 
<h:form> 
<h:commandLink action="/darkFiber/List" value="Open Dark Fiber Table" target="_blank"/> 
</h:form> 
<h:form> 
<h:commandLink action="/darkFiberCircuitIdAid/List" value="Open Dark Fiber Circuit ID Aid Table" target="_blank"/> 
</h:form> 
</h:body> 
</html> 

改變BalusC建議,並收到錯誤和堆棧追蹤結果。請參閱下面的錯誤&堆棧跟蹤:

An Error Occurred: 
/faces/index.xhtml Not Found in ExternalContext as a Resource 
- Stack Trace 

com.sun.faces.context.FacesFileNotFoundException: /faces/index.xhtml Not Found in ExternalContext as a Resource 
    at com.sun.faces.facelets.impl.DefaultFaceletFactory.resolveURL(DefaultFaceletFactory.java:232) 
    at com.sun.faces.facelets.impl.DefaultFaceletFactory.resolveURL(DefaultFaceletFactory.java:273) 
    at com.sun.faces.facelets.impl.DefaultFaceletFactory.getMetadataFacelet(DefaultFaceletFactory.java:209) 
    at com.sun.faces.application.view.ViewMetadataImpl.createMetadataView(ViewMetadataImpl.java:114) 
    at com.sun.faces.lifecycle.RestoreViewPhase.execute(RestoreViewPhase.java:233) 
    at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101) 
    at com.sun.faces.lifecycle.RestoreViewPhase.doPhase(RestoreViewPhase.java:116) 
    at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118) 
    at javax.faces.webapp.FacesServlet.service(FacesServlet.java:593) 
    at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1542) 
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:281) 
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175) 
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655) 
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595) 
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:161) 
    at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:331) 
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231) 
    at com.sun.enterprise.v3.services.impl.ContainerMapper$AdapterCallable.call(ContainerMapper.java:317) 
    at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:195) 
    at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:849) 
    at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:746) 
    at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1045) 
    at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:228) 
    at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137) 
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104) 
    at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90) 
    at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79) 
    at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54) 
    at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59) 
    at com.sun.grizzly.ContextTask.run(ContextTask.java:71) 
    at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532) 
    at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513) 
    at java.lang.Thread.run(Thread.java:722) 

回答

3

如果你已經對/index.xhtml而不是*.xhtml的URL模式映射web.xmlFacesServlet,可以發生。

相應地修復它。

<servlet-mapping> 
    <servlet-name>facesServlet</servlet-name> <!-- Or whatever name it has --> 
    <url-pattern>*.xhtml</url-pattern> 
</servlet-mapping> 

更新:按你的新的問題後的變化,

com.sun.faces.context.FacesFileNotFoundException:/faces/index.xhtml不在的ExternalContext找到的a資源

從瀏覽器地址欄中的URL中刪除/faces部分。

+0

謝謝你的回覆。按照您的建議更改了web.xml源代碼。該頁面不再加載。我將發佈錯誤和堆棧跟蹤。 – RGS

+0

只需在你的問題中編輯它。你不應該把它作爲答案,因爲,這不是一個答案。 – BalusC

+0

從瀏覽器地址欄中的URL中刪除'/ faces'部分。 – BalusC

相關問題