0

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"?

Community
  • 1
  • 1
Steve Gom
  • 75
  • 3
  • 9
  • 1
    I'm not sure I understand what you mean. Do you mean you want to include CSS files, so the stylings can be used in the body? – Michael Aug 10 '12 at 01:50

2 Answers2

3

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.

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
0

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.

Sai Ye Yan Naing Aye
  • 6,622
  • 12
  • 47
  • 65