aspose file tools*
The moose likes JSP and the fly likes JSTL not working on tomcat 4.1.18 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "JSTL not working on tomcat 4.1.18" Watch "JSTL not working on tomcat 4.1.18" New topic
Author

JSTL not working on tomcat 4.1.18

Dinkar Chaturvedi
Ranch Hand

Joined: Mar 27, 2007
Posts: 42

Why doesn't the following simple code work fine with tomcat version 4.1.18 but the same works fine with tomcat 5.0.16? Tomcat 4.1.18 conforms to the Servlet 2.3 and JSP 1.2 specifications too.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<%@ taglib uri='http://java.sun.com/jstl/fmt' prefix='fmt' %>
<title><fmt:message key='index.window-title'/></title>
</head>

<body>
<h2><fmt:message key='index.greeting'/></h2>
</body>
</html>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

fmt:message is also supported in JSTL1.0.
What kind of error do you have ?


[My Blog]
All roads lead to JavaRanch
Dinkar Chaturvedi
Ranch Hand

Joined: Mar 27, 2007
Posts: 42

I am getting the following exception....

org.apache.jasper.JasperException: This absolute uri (http://java.sun.com/jstl/fmt) cannot be resolved in either web.xml or the jar files deployed with this application

I have included all the required jar files so it works in higher versions of tomcat

Do i need to include something in the web.xml?
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

Can you post your web-app tag in web.xml ? Are you using version 2.3 ?
Dinkar Chaturvedi
Ranch Hand

Joined: Mar 27, 2007
Posts: 42

This is the web.xml as requested by you. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
<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">
<servlet>
<servlet-name>Chapter1 Servlet</servlet-name>
<servlet-class>Ch1Servlet</servlet-class>
<init-param>
<param-name>paramone</param-name>
<param-value>abc@xyz.com</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>Chapter1 Servlet</servlet-name>
<url-pattern>/Serv1</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>Ch3 Beer</servlet-name>
<servlet-class>com.example.web.BeerSelect</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Ch3 Beer</servlet-name>
<url-pattern>/SelectBeer.do</url-pattern>
</servlet-mapping>
<context-param>
<param-name>ctxparam</param-name>
<param-value>yahoo@gmail.com</param-value>
</context-param>
<listener>
<listener-class>
MyServletContextListener
</listener-class>
</listener>
<!--session timeout is in minutes-->
<session-config>
<session-timeout>15</session-timeout>
</session-config>
<servlet>
<servlet-name>TestJSPServlet</servlet-name>
<jsp-file>/test.jsp</jsp-file>
<init-param>
<param-name>paramone</param-name>
<param-value>abc@xyz.com</param-value>
</init-param>
</servlet>
<jsp-config>
<jsp-property-group>
<url-pattern>*.jsp</url-pattern>
<scripting-invalid>false</scripting-invalid> <!--false is the default setting-->
<!--el-ignored>false</el-ignored--> <!--false is the default setting-->
</jsp-property-group>
<taglib>
<taglib-uri>DiceFunctions</taglib-uri>
<taglib-location>/WEB-INF/DiceRoller.tld</taglib-location>
</taglib>
</jsp-config>
</web-app>

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
I guess you are asking the version of Servlet specification. I am getting this error on tomcat 4.1.31 which conforms to Servlet 2.3 and JSP 1.2 specs. The JSTL version being used is 1.1
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

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


Why are you using a 2.4 schema descriptor in a container that supports up to 2.3?


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42277
    
  64
JSTL 1.1 requires Servlet API 2.4/JSP 2.0 - it will not run on Tomcat 4.


Ping & DNS - my free Android networking tools app
Dinkar Chaturvedi
Ranch Hand

Joined: Mar 27, 2007
Posts: 42

Ohh!! so that means to get my application running on tomcat 4 i need to use JSTL 1.0 and change the schema descriptor to 2.3 instead of 2.4

Getting JSTL 1.0 is fine. what changes should i make in the schema?
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14688
    
  16

You'll have to change the number first. But then you may experience problems. For example, the order of element in the deployment descriptor is important in version 2.3, and your web.xml does not seem to follow that rule.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Is upgrading your version of Tomcat out of the question?
Dinkar Chaturvedi
Ranch Hand

Joined: Mar 27, 2007
Posts: 42

well its like our priority is to make sure that the app runs fine on all versions of tomcat 4 and above. So until we have a good reason like escalating efforts or compatibility problems due to this, we cant drop that idea. Otherwise we'd prefer to make it portable atleast till version 4.0

And as i mentioned its running fine on versions above.

Satou, can you point me to some place where i can get more info about the details of 2.3 so that i can make appropriate changes and make it run?
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Tomcat ships with a deployement descriptor in the ROOT webapp.
The easiest way to make sure that yours matches the container version is to start with a copy of that one.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JSTL not working on tomcat 4.1.18