How to use Favicon in Maven based Java web application?

PeakGen :

I have a web application developed in Java, and it is in Maven structure. I added the favicon.png to src/main/resources location and used the following tagline in JSP.

<head>
        <link rel="icon" type="image/png" href="favicon.png"/>
</head>

But unfortunately the favicon is not visible. How can I fix this issue?

Karthikeyan Vaithilingam :

The favicon should be in your context root.

If you have src\main\webapp place it there, also if you want to load from classpath place it in src\main\resources\META-INF\resources

NOTE: If your application have context other than root (i.e. \) then you have to append it to the href.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=132816&siteId=1