Solved

Example of simple application using a hosted Tomcat environment

Posted on 2006-06-22
5
600 Views
Last Modified: 2013-11-24
Recently I got a hosting package with jsp capabilities that are running under Tomcat 5.5.16.  I think the server is running just fine because the following .jsp file give the output "2 + 2 = 4":

<%@ page contentType="text/html; charset=UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core"
    prefix="c" %>

<html>
<head><title>Localized Dates</title></head>
<body bgcolor="white">
2 + 2 = <%= 2 + 2 %>
</body>
</html>

The servlet engine document directory is as follows:

jsp
  ROOT
    META-INF
    WEB-INF
    index.jsp

My problem is that I've read about the deployment directory structure several times without fully implementing an example.  I think a good resource about the server/deployment environment is at:
http://tomcat.apache.org/tomcat-5.5-doc/appdev/deployment.html

What I want to do is setup a simple app that is making use of packages and/or libraries so that I can get the hang of this structure.  For instance, the following example by weblogic has a Calendar.jsp file that uses the CalendarBean class to do a simple page that displays a calendar.  I've tried it a couple of ways but I keep getting errors.  I don't think it would help to list them because I would like to learn from a clean example.
http://www.weblogic.com/docs51/intro/intro_jsp.html

Could someone please provide either a link to or an example of creating a simple application where the meat of the example is in the using the deployment structure to load classes, libraries and packages as opposed to the code itself. Thank you very much.
0
Comment
Question by:wsbdc-questions
5 Comments
 
LVL 15

Accepted Solution

by:
Javatm earned 168 total points
ID: 16964342
You can use netbeans to develop and run your web application. You dont need any thing else this IDE has it all even a built-in tomcat. Once
your able to develop one you can just put the tar file("Compressed Apps") of your application to the tomcat/webapp
folder to be deployed on your site.

Here is a document that can kick start your needs : http://www.netbeans.org/kb/50/quickstart-webapps.html
You can download netbeans here : http://www.netbeans.info/downloads/download.php?type=5.0
0
 
LVL 4

Assisted Solution

by:evnafets
evnafets earned 166 total points
ID: 16964345
I think all that is missing from that weblogic example, is that fact that your classes should be deployed under the WEB-INF/classes directory, in their package structure.
So the bean example.intro.CalendarBean should be in the directory: /WEB-INF/classes/examples/intro/CalendarBean.class

The standard Structure in Tomcat would be
[TOMCAT]
--webapps      
   --[myContext]
      --index.jsp
      --WEB-INF
         --web.xml

Most times you won't be deploying under the root context, but rather under your own context directory.
I find that this tutorial is also an excellent intro for the basics: http://www.coreservlets.com/Apache-Tomcat-Tutorial/
     
0
 
LVL 27

Assisted Solution

by:rrz
rrz earned 166 total points
ID: 16965468
If you are going to use a Servlet 2.4 header in your context's web.xml , then you can use  
<html>
<head><title>Localized Dates</title></head>
<body bgcolor="white">
2 + 2 = ${2 + 2}
</body>
</html>
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I had a project requirement for a displaying a user workbench .This workbench would consist multiple data grids .In each grid the user will be able to see a large number of data. These data grids should allow the user to 1. Sort 2. Export the …
Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
The viewer will learn how to implement Singleton Design Pattern in Java.
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.

860 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question