How to add an element to the html head in an arbitrary sub-JSP page

298 views Asked by At

So I have my main JSP page which includes a number of sub-JSP pages hierarchically.

Some of these sub-JSP pages have scripts and styles that need to be included along with them, but I want the styles and the script tags to be in the head of the document.

Is this possible without using JavaScript?

1

There are 1 answers

0
Samuel EUSTACHI On

There can be good reasons not to ship all your scripts (or css) altogether.

However, in many cases, this is a perfectly valid approach. You just have to take care of avoiding colisions.

So I would recommand to put your javascript in some .js file(s), your css in .css file(s), and load at least all your css, and the required js, for all pages requiring their content.

if you need a more modular approach, please be a bit more specific, so we can see what fits best your needs