Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSTL not working on tomcat 4.1.18

 
Dinkar Chaturvedi
Ranch Hand
Posts: 42
Android Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
fmt:message is also supported in JSTL1.0.
What kind of error do you have ?
 
Dinkar Chaturvedi
Ranch Hand
Posts: 42
Android Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you post your web-app tag in web.xml ? Are you using version 2.3 ?
 
Dinkar Chaturvedi
Ranch Hand
Posts: 42
Android Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
<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?
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
JSTL 1.1 requires Servlet API 2.4/JSP 2.0 - it will not run on Tomcat 4.
 
Dinkar Chaturvedi
Ranch Hand
Posts: 42
Android Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is upgrading your version of Tomcat out of the question?
 
Dinkar Chaturvedi
Ranch Hand
Posts: 42
Android Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 13411
Firefox Browser Redhat VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic