You have several problems here.

First, if you're trying to use the EL in JSP, you should probably use
web-app 2.4, not 2.3.  Read the Servlet 2.4 specification for more
details about this.  If you do this, some of your EL references in the
JSP will be simpler.

Second, you don't need to copy the ".tld" file into your WEB-INF/tlds
directory, and you don't need a taglib directive in your web.xml.  Since
Servlet 2.3, if your taglib directive in the JSP references the URI
specified in the .tld that's stored in the jar file itself, then you
don't need to extract the .tld or use the taglib directive in the
web.xml.  This is only a recommendation, however.  You can still do all
that extra work if you like.

Assuming you fix the dtd reference in your web.xml, then your page could
look like this (an EL reference uses "$" and "{}" surrounding the
expression, read the JSTL spec for more details):

<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"; %>
<html>
 <body bgcolor="#FFFFFF"> How does one remember colors of the
rainbow?</BR> <br> <br>
  <table width="300" border="1">
   <tr>
    <td width="67%"><b><i>Name</i></b></td><td><b><i>RGB
Value</i></b></td>
   </tr>
   <c:forEach var="color" items="${colors}">
    <%-- In JSP 2.0, raw text can contain EL references, outside of
"c:out". --%>
    <tr bgcolor="#${color.RGBValue}">
     <td>${color.name}</td>
     <td>${color.RGBValue}</td>
    </tr>
   </c:forEach>
  </table>
 </body>
</html>

> -----Original Message-----
> From: A mailing list about Java Server Pages specification 
> and reference [mailto:[EMAIL PROTECTED] On Behalf Of 
> Edward King
> Sent: Friday, December 31, 2004 8:04 PM
> To: JSP-INTEREST@JAVA.SUN.COM
> Subject: JSTL question
> 
> 
> I have downloaded Standard-1.1:JSTL 1.1(2.0), I put jstl.jar 
> and standard.jar into directory of test/WEB-INF/lib,and put 
> c.tld into directory of test/WEB-INF/tlds,web.xml is follows: 
> <?xml version="1.0" encoding="ISO-8859-1"?> <!DOCTYPE web-app
>     PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
>     "http://java.sun.com/dtd/web-app_2_3.dtd";>
> <web-app>
>  <description>
>   examples
>  </description>
>  <display-name>JSPtagWAR</display-name>
>  <listener>
>   <listener-class>
>    jsptl.examples.startup.JSPTLExamplesInit
>   </listener-class>
>  </listener>
>  <taglib>
>   <taglib-uri>http://java.sun.com/jsp/jstl/core</taglib-uri>
>   <taglib-location>/WEB-INF/tlds/c.tld</taglib-location>
>   </taglib>
> </web-app>
> 
> I write a jsp file,named forEachColor.jsp:
> <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"; 
> %> <html> <body bgcolor="#FFFFFF"> How does one remember 
> colors of the rainbow?</BR> <br> <br> <table width="300" 
> border="1">  <tr>
>   <td width="67%"><b><i>Name</i></b></td><td><b><i>RGB 
> Value</i></b></td>  </tr>  <c:forEach var="color" items="$colors">
>   <tr bgcolor="#<c:expr value='$color.RGBValue'/>">
>    <td><c:expr value="$color.name"/></td>
>    <td><c:expr value="$color.RGBValue"/></td>
>   </tr>
>  </c:forEach>
> </table>
> </body>
> </html>
> then I start Tomcat5.0,I visite this page: 
> http://localhost:8080/test/forEachColor.jsp
> But I got errors,why raised errors? How to modify it?
> Thanks!
> org.apache.jasper.JasperException: /forEachColor.jsp(12,16) 
> No tag "expr" defined in tag library imported with prefix "c"
>         at 
> org.apache.jasper.compiler.DefaultErrorHandler.jspError(Defaul
> tErrorHandler.java:83)
>         at 
> org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispa
> tcher.java:363)
>         at 
> org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispa
> tcher.java:233)
>         at 
> org.apache.jasper.compiler.Parser.parseCustomTag(Parser.java:1329)
>         at 
> org.apache.jasper.compiler.Parser.parseElements(Parser.java:1568)
>         at 
> org.apache.jasper.compiler.Parser.parseBody(Parser.java:1769)
>         at 
> org.apache.jasper.compiler.Parser.parseOptionalBody(Parser.java:1083)
>         at 
> org.apache.jasper.compiler.Parser.parseCustomTag(Parser.java:1381)
>         at 
> org.apache.jasper.compiler.Parser.parseElements(Parser.java:1568)
>         at org.apache.jasper.compiler.Parser.parse(Parser.java:166)
>         at 
> org.apache.jasper.compiler.ParserController.parse(ParserContro
> ller.java:269)
>         at 
> org.apache.jasper.compiler.ParserController.parse(ParserContro
> ller.java:155)
>         at 
> org.apache.jasper.compiler.ParserController.parse(ParserContro
> ller.java:142)
>         at 
> org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:245)
>         at 
> org.apache.jasper.compiler.Compiler.compile(Compiler.java:448)
>         at 
> org.apache.jasper.compiler.Compiler.compile(Compiler.java:434)
>         at 
> org.apache.jasper.JspCompilationContext.compile(JspCompilation
> Context.java:571)
>         at 
> org.apache.jasper.servlet.JspServletWrapper.service(JspServlet
> Wrapper.java:303)
>         at 
> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet
> .java:293)
>         at 
> org.apache.jasper.servlet.JspServlet.service(JspServlet.java:240)
>         at 
> javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
>         at 
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilt
> er(ApplicationFilterChain.java:288)
>         at 
> org.apache.catalina.core.ApplicationFilterChain.doFilter(Appli
> cationFilterChain.java:206)
>         at 
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardW
> rapperValve.java:294)
>         at 
> org.apache.catalina.core.StandardValveContext.invokeNext(Stand
> ardValveContext.java:151)
>         at 
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipel
> ine.java:490)
>         at 
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1020)
>         at 
> org.apache.catalina.core.StandardContextValve.invoke(StandardC
> ontextValve.java:196)
>         at 
> org.apache.catalina.core.StandardValveContext.invokeNext(Stand
> ardValveContext.java:151)
>         at 
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipel
> ine.java:490)
>         at 
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1020)
>         at 
> org.apache.catalina.core.StandardContext.invoke(StandardContex
> t.java:2625)
>         at 
> org.apache.catalina.core.StandardHostValve.invoke(StandardHost
> Valve.java:180)
>         at 
> org.apache.catalina.core.StandardValveContext.invokeNext(Stand
> ardValveContext.java:151)
>         at 
> org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDi
> spatcherValve.java:171)
>         at 
> org.apache.catalina.core.StandardValveContext.invokeNext(Stand
> ardValveContext.java:149)
>         at 
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReport
> Valve.java:172)
>         at 
> org.apache.catalina.core.StandardValveContext.invokeNext(Stand
> ardValveContext.java:149)
>         at 
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipel
> ine.java:490)
>         at 
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1020)
>         at 
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEn
> gineValve.java:163)
>         at 
> org.apache.catalina.core.StandardValveContext.invokeNext(Stand
> ardValveContext.java:151)
>         at 
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipel
> ine.java:490)
>         at 
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1020)
>         at 
> org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.
> java:196)
>         at 
> org.apache.coyote.http11.Http11Processor.process(Http11Process
> or.java:612)
>         at 
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandle
> r.processConnection(Http11Protocol.java:430)
>         at 
> org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoi
> nt.java:565)
>         at 
> org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(
> ThreadPool.java:623)
>         at java.lang.Thread.run(Thread.java:536)
> 
> ==============================================================
> =============
> To unsubscribe: mailto [EMAIL PROTECTED] with body: 
> "signoff JSP-INTEREST". For digest: mailto 
> [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".
> 
> Some relevant archives, FAQs and Forums on JSPs can be found at:
> 
>  http://java.sun.com/products/jsp  
> http://archives.java.sun.com/jsp-interest.html
>  http://forums.java.sun.com
>  http://www.jspinsider.com
> 

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST".

Some relevant archives, FAQs and Forums on JSPs can be found at:

 http://java.sun.com/products/jsp
 http://archives.java.sun.com/jsp-interest.html
 http://forums.java.sun.com
 http://www.jspinsider.com

Reply via email to