File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Tomcat and the fly likes Running JSP in Tomcat 5.5 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Running JSP in Tomcat 5.5" Watch "Running JSP in Tomcat 5.5" New topic

Running JSP in Tomcat 5.5

Mary Gates

Joined: Mar 20, 2005
Posts: 7
Hello, I just installed the latest tomcat version and I am able to run all the examples in Tomcat.
I created a jsp page for my own called MYHELLO.jsp as the following and copy it to C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps
and I got an error of The requested resource (/MYHELLO.jsp) is not available. Please help.


<%@ page contentType="text/html" %>
<%@ taglib prefix="c" uri="" %>
<title> HEllo </title>
<body bgcolor="RED">
1+2+3=<C UT VALUE="${1+2+3}"/>
[ March 20, 2005: Message edited by: Bear Bibeault ]
Bear Bibeault
Author and ninkuma

Joined: Jan 10, 2002
Posts: 63838

Moved to the Tomcat forum.

[Asking smart questions] [About Bear] [Books by Bear]
David Ulicny
Ranch Hand

Joined: Aug 04, 2004
Posts: 724
You must create WAR file and your JSP file must be a part of it. Use ANT or your IDE for creating the WAR file.

SCJP<br />SCWCD <br />ICSD(286)<br />MCP 70-216
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13035
No you don't HAVE to creat a WAR file - for just experimenting, all you have to do is put the JSP in a web application directory that knows how to run JSP.

IS NOT a web application directory - webapps\ROOT is the default web application directory. It already has a WEB-INF, etc -
Md Fizal
Ranch Hand

Joined: Dec 23, 2002
Posts: 61
I'm having a similar issue wtih Tomcat 5.0.27 compiling JSPs. I have my JSPs under a different directory and pointing the docBase tag in fragment context xml to this directory.

My current running application on Tomcat 4 uses JSP 1.1 version. Looks like Tomcat 5 is not compiling my useBean tags and custom tag libs properly. Any idea if any refactoring of the JSP code is required to migrate to JSP 2 version?

Following is the error I get
Ben Souther

Joined: Dec 11, 2004
Posts: 13410

TC four was more forgiving if you try to use a non-bean tag with the useBean tag.

A Boolean is not a bean.
Try using "type=.." in your useBean tags instead of "class=".
Better yet, only use classes that comply with the definition of a javabean with jsp:useBean.

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Md Fizal
Ranch Hand

Joined: Dec 23, 2002
Posts: 61
Thanks a lot. Problem with useBean is solved now. But, JSP custom tags are still giving me hard time. I have a tag with zero parameters like this:

When I saw the source Tomcat 4 & 5 generated I saw the following difference.

In tomcat 4 :
In tomcat 5:

Can anyone help me why it's different?

Here is the error message I get:
Md Fizal
Ranch Hand

Joined: Dec 23, 2002
Posts: 61
I found the problem. The problem was with Tomcat 5 tag pooling feature which will be turned on by default, because of which custom tag library tags are parsed in a different order than regular.

In order to turn off tag pooling in Tomcat 5, add the following in $CATALINA_HOME/conf/web.xml, locate the
servlet, and add:

[ March 25, 2005: Message edited by: Md Fizal ]
I agree. Here's the link:
subject: Running JSP in Tomcat 5.5
It's not a secret anymore!