Solved

Deploying Jsp's on tomcat

Posted on 2002-06-19
4
348 Views
Last Modified: 2013-11-24
We  have to create a web based application

1. we made a war fike of our application and when we unzipped it it created a folder in which all the classes,beans and jsp's existed.

2. We put a line in "server.xml" for the <context>
So now when we type..
http://localhost:8080/Webapp
It shows the directory listing.
This goes on till
/usr/tomcat3/jakarta-tomcat-4.0.3/Webapp/src/docroot
When we click on docroot we get the index.html page
Also when we give
/usr/tomcat3/jakarta-tomcat-4.0.3/Webapp/src/compose.jsp
we get the page.

3.But still the pages which refer to servlets can't be displayed
I think the problem is with web.xml
There is one web.xml also for our package .. please lemme know what exactly should we put in it so that it can access the beans
Like there is
<servlet>
<servlet-mapping>
there are tld's.
so what exactly should we do.
0
Comment
Question by:akanksha
4 Comments
 
LVL 1

Accepted Solution

by:
mraible earned 20 total points
ID: 7092734
Your web.xml should be in the WEB-INF directory.  You can define a welcome-file that you can point to your JSP.

Typically, here's how I structure my "webapps"

$TOMCAT_HOME/webapps/
    --myApp/
        --index.jsp
        --*.jsp
        --images/
            --*.gif
            --*.jpg
        --styles/
            --*.css
        --scripts/
            --*.js
        --WEB-INF/
            --*.xml
            --classes/
            --lib/
            --tlds/

Good examples can be found by looking at some struts examples: http://jakarta.apache.org/struts

Here is the web.xml from the struts-example application:

<?xml version="1.0" encoding="ISO-8859-1"?>

<!DOCTYPE web-app
  PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
  "http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">

<web-app>


  <!-- Action Servlet Configuration -->
  <servlet>
    <servlet-name>action</servlet-name>
    <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
    <init-param>
      <param-name>config</param-name>
      <param-value>/WEB-INF/struts-config.xml</param-value>
    </init-param>
    <init-param>
      <param-name>debug</param-name>
      <param-value>3</param-value>
    </init-param>
    <init-param>
      <param-name>detail</param-name>
      <param-value>3</param-value>
    </init-param>
    <load-on-startup>2</load-on-startup>
  </servlet>


  <!-- Action Servlet Mapping -->
  <servlet-mapping>
    <servlet-name>action</servlet-name>
    <url-pattern>*.do</url-pattern>
  </servlet-mapping>


  <!-- The Welcome File List -->
  <welcome-file-list>
    <welcome-file>index.jsp</welcome-file>
  </welcome-file-list>

  <!-- Application Tag Library Descriptor -->
  <taglib>
    <taglib-uri>/WEB-INF/app.tld</taglib-uri>
    <taglib-location>/WEB-INF/app.tld</taglib-location>
  </taglib>

  <!-- Struts Tag Library Descriptors -->
  <taglib>
    <taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
    <taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
  </taglib>

  <taglib>
    <taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
    <taglib-location>/WEB-INF/struts-html.tld</taglib-location>
  </taglib>

  <taglib>
    <taglib-uri>/WEB-INF/struts-logic.tld</taglib-uri>
    <taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
  </taglib>

</web-app>



0
 
LVL 2

Expert Comment

by:vasan_sr
ID: 7095251
Hi...
    http://localhost:8080

whether this link is working for u .....it will display the default home page of tomcat.......in that u can see samples of jsp and servlets..adn u can try executing it...

    check whether this is working.....then there will be server.xml file inside conf directory .......that i will explain later....first check the above is working fine..

u can send mail to vasan@scapevelocity.com for any queries...

VasanS
0
 
LVL 35

Expert Comment

by:girionis
ID: 8860565
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this
question is:

- points to mraible

Please leave any comments here within the
next seven days.

PLEASE DO NOT ACCEPT THIS COMMENT AS AN ANSWER !

girionis
Cleanup Volunteer
0

Featured Post

Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

Join & Write a Comment

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 …
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

707 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

15 Experts available now in Live!

Get 1:1 Help Now