tomcat-taglibs-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Hans Bergsten <h...@gefionsoftware.com>
Subject Re: is this link correct?
Date Wed, 22 Oct 2003 06:22:20 GMT
Wallace wrote:
> Hi Hans, I have put JSTL 1.0 jar files in the WEB-INF/lib and it still
> won't read my script. In tomcat 5 I tested out just the core library and
> it doesn't give me the functionality I desire, what I want is core_rt
> for run time EL. 

The "core_rt" library belongs to JSTL 1.0 and is intended to be used
only when you want to use Java expressions in attribute values, not EL
expressions:

   <c:out value='<%= request.getParameter("foo") %>" />

The "rt" part means "request-time attribute value", which in JSP 1.2
means "Java expression", and all attributes are declared to accept
such values.

Tomcat 5 implements JSP 2.0, where "request-time attribute value" means
"either Java or EL expression". That's why you can use EL expressions
with the JSTL 1.0 "core_rt" library in Tomcat 5. However, you should
use JSTL 1.1 and the new URIs I posted instead.

 > But because Tomcat 4 doesn't have such thing, I'm
> stuck. And I must use Tomcat 4 because of the provider. My friend can't
> afford a provider with tomcat 5 on it.

Tomcat 4 is JSP 1.2, and by itself it doesn't have _any_ JSTL libraries
at all. You need to install a JSTL 1.0 implementation (e.g., the
Standard 1.0.3 library from Jakarta Taglibs) first (i.e., copy the JAR
files to WEB-INF/lib as I described earlier) You must then use the _EL_ 
library URIs in the taglib directive, i.e., "core" instead of "core_rt":

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

Hans

> -----Original Message-----
> From: Hans Bergsten [mailto:hans@gefionsoftware.com] 
> Sent: Tuesday, October 21, 2003 2:24 PM
> To: Tag Libraries Users List
> Subject: Re: is this link correct?
> 
> Wallace wrote:
> 
>>Hi Manos,
>>  I cannot change the provider because I am writing this jsp for a
>>friend and he is set on using this provider due to costs. I am stuck
>>with a tomcat 4 container and just wondering what I would have to do
> 
> to
> 
>>make it work for tomcat 4 instead. In jstl what is the syntax to
> 
> extract
> 
>>an html form's input data? Do I need to use <c:out>? And do I have to
>>create a web.xml to refer to tlds? Or can I just use a uri like I did
>>for tomcat 5? I did all my development and testing in tomcat 5, so JSP
> 
> 2
> 
>>syntax is all I know.
> 
> 
> For JSP 1.2 (e.g., Tomcat 4.x), you should use the JSTL 1.0 EL
> libraries:
> 
>    <%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
>    <%@ taglib prefix="x" uri="http://java.sun.com/jstl/xml" %>
>    <%@ taglib prefix="fmt" uri="http://java.sun.com/jstl/fmt" %>
>    <%@ taglib prefix="sql" uri="http://java.sun.com/jstl/sql" %>
> 
> and a Servlet 2.3 web.xml file:
> 
>    <?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>
>      ...
>    </web-app>
> 
> For JSP 2.0 (e.g., Tomcat 5.x), you should use the JSTL 1.1 libraries:
> 
>    <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
>    <%@ taglib prefix="x" uri="http://java.sun.com/jsp/jstl/xml" %>
>    <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
>    <%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql" %>
>    <%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"
> %>
> 
> and a Servlet 2.4 web.xml file:
> 
>    <?xml version="1.0" encoding="ISO-8859-1"?>
>    <web-app xmlns="http://java.sun.com/xml/ns/j2ee"
>      xmlns:xsi="http://www.w3c.org/2001/XMLSchema-instance"
>      xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
>        http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"
>      version="2.4">
>      ...
>    </web-app>
> 
> For both JSP versions, just place the JSTL implementation JAR files
> (e.g., all JAR files in "lib" directory the Standard tag library binary
> distribution) in the WEB-INF/lib directory of the web application and
> use the appropriate taglib directives in the JSP pages, as shown above.
> 
> Do _not_ use any tag library declarations in the web.xml file. At best,
> they are redundant since JSP 1.2, at worst they cause the application
> to fail.
> 
> Some containers already include a JSTL implementation, so you don't have
> to put any JSTL implementation JAR files in WEB-INF/lib, but doing so
> shouldn't hurt anything.
> 
> Hans


-- 
Hans Bergsten                                <hans@gefionsoftware.com>
Gefion Software                       <http://www.gefionsoftware.com/>
Author of O'Reilly's "JavaServer Pages", covering JSP 1.2 and JSTL 1.0
Details at                                    <http://TheJSPBook.com/>


---------------------------------------------------------------------
To unsubscribe, e-mail: taglibs-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: taglibs-user-help@jakarta.apache.org


Mime
View raw message