Tomcat JSF错误

Tomcat JSF错误,jsf,tomcat,Jsf,Tomcat,我正在用JSF构建一个页面,并在Eclipse中的Tomcat上运行它。在我每次尝试加载页面时都会出现这些错误之前,一切都很顺利。页面看起来有误,eclipse控制台向我显示了大约12个错误,如下所示: 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.

我正在用JSF构建一个页面,并在Eclipse中的Tomcat上运行它。在我每次尝试加载页面时都会出现这些错误之前,一切都很顺利。页面看起来有误,eclipse控制台向我显示了大约12个错误,如下所示:

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>

WebTime:一个简单的例子
web服务器上的当前时间:#{webTimeBean.time}

建议只使用jsf标记,不要混合使用标准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中,检查Facesservlet模式。在我看来,tomcat试图在/as jsf下编译每个文件。所以,改变你的面孔,pathern和


试试看,如果你仍然有相同的“警告”,请告诉我。

请在这里发布你页面的源代码,我删除了所有不重要的内容,我在页面中放置的每一张图片都会出现错误…问题出在我的web.xml文件中。。。在url模式下,我只有“/”。我把它改为/MyApplication/*现在它工作得很好。谢谢你的提示:)