JSTL and Struts

Trying to use the JSTL in jsp'sWhat are necessary steps that I have to do? Where can I find info on the same.I see in the forums that web.xml has to be modified.I am not sure what I have to write.I would appreciate your helpThanks.
[274 byte] By [Rxyza] at [2007-10-2 6:43:07]
# 1

I did try giving this. But getting IllegaArgumentException. unknown version.

There are 2 dtd's I see in the WEB-INF folder

web-app_2_2.dtd

web-app_2_3.dtd

<!DOCTYPE web-app

PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"

"http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">

<web-app xmlns="http://java.sun.com/xml/ns/j2ee"

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"

version="2.4">

what should I change this to?

Thanks.

Rxyza at 2007-7-16 13:51:33 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 2

[nobr]What server are you using for your JSPs?

Put this at the top of a JSP, and it should tell you the relevant info

<h2> Server Info </h2>

Server info = <%= application.getServerInfo() %> <br>

Servlet engine version = <%= application.getMajorVersion() %>.<%= application.getMinorVersion() %><br>

Java version = <%= System.getProperty("java.vm.version") %><br>

With Servlet 2.3, you need JSTL1.0

With Servlet 2.4, you need JSTL1.1

You need to

- copy jstl.jar/standard.jar to your web-inf/lib directory.

If you have Servlet2.4 (eg Tomcat 5) then you need to have your web.xml file as version 2.4. Copy the standard xml file from the ROOT directory.

With a Servlet2.4, your web.xml should look something like this:

<?xml version="1.0" encoding="UTF-8"?>

<!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>

...

with 2.4 it should be something like this:

<?xml version="1.0" encoding="ISO-8859-1"?>

<web-app xmlns="http://java.sun.com/xml/ns/j2ee"

xmlns:xsi="http://www.w3.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">

Note the second one removes the <%!DocType tag and replaces it with XMLNS stuff in the web-app tag.

Good luck,

evnafets[/nobr]

evnafetsa at 2007-7-16 13:51:33 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 3

thanks for your response.

I am using Servlet 2.4 and Tomcat 5....

Where to get the web.xml from?

you mentioned

If you have Servlet2.4 (eg Tomcat 5) then you need to have your web.xml file as version 2.4. Copy the standard xml file from the ROOT directory.

Where is this ROOT directory?

thanks.

Rxyza at 2007-7-16 13:51:33 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...
# 4
Thanks evnafets .I know from where I can get this xml. Thanks a lot for helping me thru this.
Rxyza at 2007-7-16 13:51:33 > top of Java-index,Enterprise & Remote Computing,Web Tier APIs...