jspjstljsp-tagsjspinclude

how to use <c:if> in jsp file. eclipse said it is unknown tag


I want to write a simple web page in .jsp file. I need to use <c:if> tag. but it is not recognized. eclipse said it is unknown tag.

I googled it and some said I need to include the standard lib (which is JSTL?).

I just want to use some basic tags in jsp file such as <c:if>. Do I really need to include any libraries? If so, what libraries do I need to include? And how to do that in Eclipse? Please let me know step by step about how to import/include these libraries or build path so that I can use <c:if> in my jsp file.


Solution

  • Make sure that you have a taglib declaration in your JSP file

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

    Also, make sure that you've added JSTL jar files to your project classpath.