How to include javascript/css once with Struts 1.x
Posted
by Felix
on Stack Overflow
See other posts from Stack Overflow
or by Felix
Published on 2010-06-03T15:58:38Z
Indexed on
2010/06/03
16:04 UTC
Read the original article
Hit count: 381
JavaScript
|struts-1
If this is the wrong approach, please suggest something better, but my current efforts have been trying to find something that exists for a single page load, such that I can cache which javascript/css files have been included so as to only include them once. I thought in a TagSupport subclass I could use
(HttpServletRequest)pageContext.getRequest().getParameterMap().put(srcKey,true)
but the request is per jsp, not per page load so it was a failure. I could set up a filter in web.xml, but it seems I would have to search the response for duplicates and rewrite the response...pain. I could try to store things in the session, but there are headaches with clearing values... Any help would be appreciated.
© Stack Overflow or respective owner