Solved

Example of simple application using a hosted Tomcat environment

Posted on 2006-06-22
5
597 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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
fizzArray3  challenge 1 66
how to use external config file with Spring MVC 4 59
count11 challenge 6 47
parentbit challenge 3 52
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 …
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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.

708 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

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now