Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Deploying Jsp's on tomcat

Posted on 2002-06-19
4
Medium Priority
?
364 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 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

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

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

By the end of 1980s, object oriented programming using languages like C++, Simula69 and ObjectPascal gained momentum. It looked like programmers finally found the perfect language. C++ successfully combined the object oriented principles of Simula w…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
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 …
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

972 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