1

When I see the page source of a certain page through google chrome, I found this line,

I'm trying to copy the page on my own to practice my html/css skills. This is the structure of my Spring MVC project. enter image description here

I copied the entire code of the page, and paste it on my index.jsp. Also, I copied all the content of application~.css file and paste it on a css file that I created. (clicked the application~.css file on page source of chrome, and it opend a page with a lot of lines, so I assumed it's the content of css file.)

but, I don't think this line gets to my css file. how come?

Should I put the file in resources folder? or WEB_INF?

href="/resources/assets/application-eaa92ddb7d6e189695e3eeadad502b4d.css"

I added resources folder into the path, but still not working.

please help me out...

1 Answer 1

1

First you have to add this tag on your spring config file:

<mvc:resources mapping="/resources/**" location="/META-INF/RESOURCES/" />

use this tag in jsp :

<%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%>

<c:url value="{path of your file}"/> 

like this examle:

<link href="<c:url value="/resources/My_CSS.css"/>" rel="stylesheet"/>

For reference go through this article: https://www.mkyong.com/spring-mvc/spring-mvc-how-to-include-js-or-css-files-in-a-jsp-page/

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.