Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Here,</p> <pre class="lang-html prettyprint-override"><code>&lt;%@ taglib prefix = "c" uri="http://java.sun.com/jstl/core"%&gt; </code></pre> <p>You're specifying the wrong JSTL taglib URL. This one is for JSTL 1.0. After JSTL 1.1 it requires a <code>/jsp</code> in the path. See also the <a href="http://docs.oracle.com/javaee/5/jstl/1.1/docs/tlddocs/index.html" rel="nofollow noreferrer">JSTL 1.1 tag library documentation</a>.</p> <pre class="lang-html prettyprint-override"><code>&lt;%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %&gt; </code></pre> <p>As to the of the code (and to reply on all those duplicate answers complaining to use <code>${}</code> instead), the <code>#{}</code> syntax will only work inside JSP when you're targeting a Servlet 2.5 / 2.1 compatible container with a <code>web.xml</code> conforming Servlet 2.5 spec. Tomcat 6.0 is an example of such a container. The <code>#{}</code> will indeed not work in JSP tags on older containers such as Tomcat 5.5 or older.</p> <p>For clarity and to avoid confusion among starters, better use <code>${}</code> all the time in JSP tags. Also better use self-documenting variable names.</p> <pre class="lang-html prettyprint-override"><code>&lt;%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %&gt; &lt;% String[] names = {"Hello", "you", "are", "using", "jstl", "in", "jsp"}; request.setAttribute("names", names); %&gt; &lt;!DOCTYPE html&gt; &lt;html lang="en"&gt; &lt;head&gt; &lt;title&gt;JSTL demo&lt;/title&gt; &lt;/head&gt; &lt;body&gt; &lt;table&gt; &lt;tr&gt;&lt;td&gt;Print&lt;/td&gt;&lt;/tr&gt; &lt;c:forEach items="${names}" var="name"&gt; &lt;tr&gt;&lt;td&gt;${name}&lt;/td&gt;&lt;/tr&gt; &lt;/c:forEach&gt; &lt;/table&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <h3>See also:</h3> <ul> <li><a href="https://stackoverflow.com/tags/jstl/info">Our JSTL wiki page</a></li> <li><a href="https://stackoverflow.com/questions/4812755/difference-between-jsp-el-jsf-el-and-unified-el">Difference between JSP EL, JSF EL and Unified EL</a></li> </ul>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload