Dynamically call CSS in a JSP
I have a JSP page which uses some kind of JSTL st开发者_开发百科atment to refer a CSS...
<jstl:tag ...href=abc.css>
Now this same abc.css is located in 3 separate folders and based on some condition it picks dynamically from one of these 3 folders..
I am not sure howitdoes that and wantec to understand if this logic iswritten somewherewithin the JSTL TLD or in some Java class...what can be the possibilities?
Thank you.
You can use the JSTL c:choose tag for this purpose. For eg:
<c:choose>
<c:when test="some condition">
<link rel="stylesheet" href="path to your css" type="text/css">
<!--If this condition is true use this css-->
</c:when>
<c:when test="some other condition">
<link rel="stylesheet" href="path to your css" type="text/css">
<!--If this condition is true use this css-->
</c:when>
<c:otherwise>
<link rel="stylesheet" href="path to your css" type="text/css">
<!--If none of the conditions are true use this css-->
</c:otherwise>
</c:choose>
精彩评论