Java.beginner
Java.beginner

Reputation: 891

Link CSS file to .JSP in Spring Framework - ver -4.1.0

I have visited previous related question to find solution but I didn't...

How to use "css" in the "jsp" in Spring MVC project?

including style sheet in a jsp page with Spring MVC

My question is how do I link css file to .jsp file in Spring MVC, this question was asked by so many of em! but unfortunately couldn't get achieved with those solution.

file structure is- https://i.sstatic.net/9WKuN.png

Please give your directions, thanks.

Upvotes: 1

Views: 1166

Answers (2)

nagamanojv
nagamanojv

Reputation: 401

I was able to achieve that with the following

<style type="text/css"><%@ include file="/css/bootstrap.css" %> </style>

where bootstrap.css was my css file and the folder structure was similar. Try that once.

Upvotes: 3

Saurabh Gaur
Saurabh Gaur

Reputation: 23805

add following line in your spring-dispatcher-servlet.xml

<mvc:resources mapping="/css/**" location="/css/" />

hope this will help you

Upvotes: 1

Related Questions