开发者

Dynamically call CSS in a JSP

开发者 https://www.devze.com 2023-03-16 21:36 出处:网络
I have a JSP page which uses some kind of JSTL st开发者_开发百科atment to refer a CSS... <jstl:tag ...href=abc.css>

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>
0

精彩评论

暂无评论...
验证码 换一张
取 消