Reputation: 75
I'm learning JSP these days, and really want to place some css files to the head during the body sequence. But I can't figure out on Java codings.
If you want to load it in the middle of the page, you can use a javascript function that does the same as the first paragraph here, except it deletes the object that appears in the body, and appends it to the head object. I do that if I use ajax to update a page. external css in body of html file
I saw this answer on other question, and I'm curious how to do it? Also I found it on how to do it on Jquery, but is there anyway on "JAVA way"?
Upvotes: 0
Views: 1288
Reputation: 6738
You can declare css file in your jsp head tag likes this;
<link rel="stylesheet" href="../css/style.css" type="text/css"></link>
and you can use this in your jsp page.
Upvotes: 0
Reputation: 168845
JSP is really just HTML by the time it reaches the browser. CSS should be imported in the head
element of the HTML document, not the body
. CSS can be defined 'on the run' in the style
attribute of an element of the body, but that is harder to maintain.
Upvotes: 3