0
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> //line-1
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c1" %>  //line-2

Is there any difference between line-1 and line-2. line-2 in jsp file is not giving any error but line-1 in another jsp giving error

Can not find the tag library descriptor for "http://java.sun.com/jsp/jstl/core"

I've seen the solution of the problem here but could not get understand what is "Facelets"

It is true that Facelets 1.x and 2.x uses different namespaces for the JSTL tag library. It was less or more a namespace bug in Facelets 1.x and has been fixed for Facelets 2.x.

You can find all Facelets 2.x tags in the Facelets tag library documentation. Facelets don't ship with the full tag set as the real JSTL taglib. Only a few of the <c:xxx> and the full set of <fn:xxx> are copied into Facelets. The <fmt:xxx>, <sql:xxx> and <xml:xxx> tags are not taken over in Facelets.

Community
  • 1
  • 1
Piyush Mittal
  • 1,860
  • 1
  • 21
  • 39
  • you cannot have same prefix for multiple TLD's – chiragchavda.ks Jul 11 '15 at 09:39
  • see the error Can not find the tag library descriptor for "http://java.sun.com/jsp/jstl/core" I am using both jstl in separate jsp file. – Piyush Mittal Jul 11 '15 at 09:43
  • http://stackoverflow.com/questions/5987908/how-to-resolve-can-not-find-the-tag-library-descriptor-for-http-java-sun-co use this link. may be there something wrong included lib – chiragchavda.ks Jul 11 '15 at 09:45
  • I have included the library that's why not getting error in line-2. but what is the means of ../jsp/jstl.. and .../jstl/..(not having jsp). – Piyush Mittal Jul 11 '15 at 09:50
  • you can find this question answer on [this][1] SO question. [1]: http://stackoverflow.com/questions/7593603/jstl-xmlns-namespace-differences-between-jsf-1-2-and-jsf-2-x – chiragchavda.ks Jul 11 '15 at 09:55
  • 1
    So, your question is essentially: "What is Facelets?" and the remainder is actually irrelevant? Have you tried copypasting "What is Facelets?" into Google? – BalusC Jul 13 '15 at 05:47

1 Answers1

2

If you are using (uses JSTL 1.2)

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

means to use EL Expressions you do not need <c:out>. You can directly insert EL expressions onto jsp page like ${propertyName}

While using (uses JSTL 1.0 deprecated)

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

You can not use EL Expressions directly on jsp page you need <c:out>. EL expressions on the page will not work. e.g. <c:out value=”${propertyName}”>.

Also your web-app version (found in web.xml) should be down to 2.3 to use http://java.sun.com/jsp/core which is again too old.

Conclusion:

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

<%@taglib prefix="c" uri="http://java.sun.com/jsp/core" %> - Can not use EL directly

Naman
  • 2,205
  • 2
  • 19
  • 32