Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Deploying Jsp's on tomcat

Posted on 2002-06-19
4
Medium Priority
?
361 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 1

Accepted Solution

by:
mraible earned 80 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Suggested Courses

664 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