Include a CSS file as inline style in a JSP

Donald Taylor picture Donald Taylor · Jul 6, 2011 · Viewed 9.1k times · Source

I have a CSS file ("style.css") that I want to embed as inline CSS in a JSP. How can this be done?

I have tried the following, but the CSS file is not imported:

<style>
  <jsp:include page="style.css" />
</style>

Thanks!

Answer

Ben picture Ben · Jul 6, 2011

This sort of directive should work, but you will need to be sure of the path you're using:

<%@ include file="/path_to/your_css_file.css" %>