You're basically reinventing what already exist in some component based MVC frameworks, such as JSF which has a <h:outputStylesheet> tag for this purpose (and <h:outputScript> for JS). I suggest to have a look at that instead of reinventing the wheel.
–
BalusCDec 8 '11 at 19:09

Thanks, BalusC. I am not sure if we can switch over to JSF. Do you know of any ways to do the same thing using only JSP and Spring MVC?
–
andyDec 8 '11 at 19:14

Everything is possible. For some cases you just have to write more code yourself than other cases. Sorry, I can't post an answer in detail as I'm not really into JSP tags and Spring MVC.
–
BalusCDec 8 '11 at 19:15

1 Answer
1

Each requireOnce tag would just put the file to link to in a list of files, stored in a request attribute. A servlet filter would buffer the whole response, and rewrite it when completed with the head section rewritten to include all the links.