2013-12-19 43 views
0

我在JSF中构建一个页面,并在Eclipse中的Tomcat上运行它。一切工作都很好,直到我每次尝试加载页面时都开始出现这些错误。页面看起来错误和Eclipse控制台错误的大约12表明我像这样的:Tomcat JSF错误

Dec 19, 2013 9:23:26 PM com.sun.faces.context.ExternalContextImpl getMimeType 
WARNING: JSF1091: No mime type could be found for file /img/sep.jsp. 
To resolve this, add a mime-type mapping to the applications web.xml. 

有趣的是,在此特定错误的心不是sep.jsp但sep.PNG文件...

<?xml version='1.0' encoding='UTF-8' ?> 
<!-- index.xhtml --> 
<!-- JSF page that displays the current time on the web server --> 
<!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>WebTime: A Simple Example</title> 
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
</h:head> 
<h:body> 
    <h1>Current time on the web server: #{webTimeBean.time}</h1> 
    <img src="img/sep.png" alt="sep.png" style="width:200px; height:200px; 
float:right;" /> 
</h:body> 
</html> 
+0

请贴出您的页面的源代码 – tmandry

+0

这是它,我删除了那些不重要的东西,我得到了我放入页面的每张图片的错误... – Pero44

回答

0

其推荐只使用jsf TAGS而不是混合标准html和jsf。

为JSF使用有效XHTML应该是财产以后这样的:

你并不需要在你的页面的顶部声明XML !!!!

<!DOCTYPE html> 
<html xmlns="http://www.w3.org/1999/xhtml" 
     xmlns:f="http://java.sun.com/jsf/core" 
     xmlns:h="http://java.sun.com/jsf/html" 
     xmlns:ui="http://java.sun.com/jsf/facelets" 
     > 
<h:head> 
    <meta charset="UTF-8" /> 
    <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> 
    <h:outputStylesheet name="stylesheet.css"/> 
    <title>Test</title>  
</h:head> 
<body> 
<f:view> 
<h:outputText value="hello"></h:outputText> 
<h:graphicImage name="img/sep.png" class="LOGO" alt="Image not found!"></h:graphicImage> 
</f:view> 
</body> 
</html> 

在您的web.xml中,检查Faces Servlet模式。在我看来,tomcat试图编译/作为jsf下的每个文件。所以改变你的脸部和北京

试试吧,让我知道你是否仍然有相同的“警告”。

+0

问题出在我的web.xml文件中。 。在url-pattern下,我只有“/”。我将其更改为/ MyApplication/*,现在它效果很好。 感谢提示:) – Pero44