Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to import a CSS file in JSP?

<%String path = application.getRealPath("/");%>
<%@page import="index.css" %>

I am using String path as above to get the real path of my directory. I want to import index.css from the css folder.

Is it possible in JSP to do something like <%@page import = path+"css/index.css"%> or is there an easier way to do this?

like image 957
ILikeTurtles Avatar asked Dec 20 '22 04:12

ILikeTurtles


2 Answers

I think you want to include index.css file to jsp. try this

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

or

<%@include file="/WEB-INF/include/header.jsp"%>

but i recommend to use tag in html

like image 68
Jaymelson Galang Avatar answered Jan 30 '23 09:01

Jaymelson Galang


Neither PHP nor JSP have anything to do with CSS.

You can link the resulting HTML to a stylesheet the same way you would in any other HTML, using the <link> tag.

like image 43
SLaks Avatar answered Jan 30 '23 07:01

SLaks