开发者

Why is this include not working in jsp?

开发者 https://www.devze.com 2023-03-28 12:13 出处:网络
I want to conditionally include a css file in my jsp page based on some parameter: <c:if test=\"${param.co == \'txmart\'}\">

I want to conditionally include a css file in my jsp page based on some parameter:

<c:if test="${param.co == 'txmart'}">
    <link
        href="resources/css/txMart.css"
        rel="styleshee开发者_如何学Pythont"
        type="text/css" />
</c:if>

I cannot understand why this does not work... It always include txMart.css file...(even if co is null or having other value) Do you see any issue?


The problem is that you didn't declare the use of the core taglib correctly. When using the classical JSP syntax, the use of a taglib must be declared like this:

<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>

The notation xmlns:c="http://java.sun.com/jstl/core" is used when the XML syntax is used. See http://download.oracle.com/docs/cd/B13597_05/web.904/b10320/jspxml.htm for details.

0

精彩评论

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