The tomcat examples all use the 2.4 web xml spec and the el is setup from there. If you're web apps are 2.3 and/or 2.2 flavoured
Copy the jstl and standard jars from the Tomcat 5 JSP examples WEB-INF/lib into your lib directory
in your jsps no need to configure web.xml its all the JAR files.
Put this at the top of your JSPs <%@ page isELIgnored="false" %>
To use the fmt tag lib just put
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
core
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
To use fmt:message rather than bean:message
put this in the top of your web.xml (needs to be in the same order as the dtd)
<context-param>
<param-name >javax.servlet.jsp.jstl.fmt.localizationContext </param-name >
<param-value >ApplicationResources </param-value >
</context-param>
2.3 spec dtd web-app icon?, display-name?, description?, distributable?, context-param*, filter*, filter-mapping*, listener*, servlet*, servlet-mapping*, session-config?, mime-mapping*, welcome-file-list?, error-page*, taglib*, resource-env-ref*, resource-ref*, security-constraint*, login-config?, security-role*, env-entry*, ejb-ref*, ejb-local-ref*
Now to test a jsp <%@ page isELIgnored="false" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <c:set var="foo" value="foo" /> ${foo}
On 9 May 2004, at 18:09, Dean A. Hoover wrote:
Thanks. I am using Tomcat 5 but I could not figure out how to get
at the JSTL stuff. I ended up grabbing the JSTL from sun and copying
TLDs and jars into my local lib directory for the application (struts is there)
and that works. I got version 1.1. I am currently reading the final spec for
JSTL and I ordered JSTL in Action. I just think it would be nice if I could
look somewhere on the struts site and see before and after examples
of these various tags. For example, logic:notPresent is replaced by,
bean:message is replaced by... with actual simple examples.
Thanks.
Dean Hoover
Niall Pemberton wrote:
You can either plug JSTL in if you are using a Version 2.3 servlet container
(e.g. Tomcat 4) or you can use a Version 2.4 Servlet Container which comes
with it (e.g. Tomcat 5)
If you need to plug it in, download JSTL version 1 from Jakarta Taglibs -
installation instructions included.
If you want to know more about JSTL:
Specification: http://www.jcp.org/aboutJava/communityprocess/final/jsr052/index.html
Sun Page: http://java.sun.com/products/jsp/jstl/
Sun Tutorial: http://java.sun.com/webservices/docs/1.0/tutorial/doc/JSTL.html#74644
Java World Article http://www.javaworld.com/javaworld/jw-02-2003/jw-0228-jstl.html
OnJava: http://www.onjava.com/pub/a/onjava/2003/11/05/jsp.html
IBM JSTL Primer (4 Parts): http://www-106.ibm.com/developerworks/java/library/j-jstl0211.html http://www-106.ibm.com/developerworks/java/library/j-jstl0318/ http://www-106.ibm.com/developerworks/java/library/j-jstl0415/ http://www-106.ibm.com/developerworks/java/library/j-jstl0520/
Niall
----- Original Message ----- From: "Dean A. Hoover" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, May 07, 2004 6:38 PM
Subject: upgrading to jstl
I have been using struts 1.1 for a couple of months now, and want to make sure I am using best practices. Most of my education has come from Struts in Action and Programming Jakarta Struts, and this mailing list. It appears that I should shift to using the JSTL tags in preference to various struts tags. Is there a write up somewhere on how to go about it? For example, based on my book learning, I embraced using message resources. So, in my JSP files I'll make reference to <bean:message key="login.title"/> and maybe in my tiles-defs.xml file I'll have a line like, <put name="title" value="forgotPassword.heading"/> How *should* I do this? Also, what about other struts tags, like logic:notPresent, etc., etc.
Is there an upgrade HOWTO someplace? When I need to use struts tags, should they be the EL versions?
Dean Hoover
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]