Add favicon from Spring MVC

给你一囗甜甜゛ 提交于 2019-12-03 15:30:20

Just to expand on NimChimpsky's anwer... put the favicon in the root (or images) directory and reference it the usual way in your JSP pages (or better still use SiteMesh to specify it once). E.g.

<link rel="shortcut icon" type="image/x-icon" href="${pageContext.request.contextPath}/favicon.ico" />

But there is a gotcha when using Tomcat, where the favicon won't get served from inside the webapp due it being a "unknown" mine type. The fix to add a custom mime type entry in web.xml:

<!-- Mimetype needed for tomcat to serve favicon images -->
<mime-mapping>
    <extension>ico</extension>
    <mime-type>image/x-icon</mime-type>
</mime-mapping>

Just store favicon.ico in the root of webapp (aka the one up from WEB-INF) directory

Arushi Jain

<div class="tab-content">
    <div id="frequent"
	class="active tab-pane fade in active text-center">
    <jsp:include page="questionDisplay.jsp" />
    </div>
</div>
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!