aspose file tools*
The moose likes Servlets and the fly likes Deploying the application Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Deploying the application" Watch "Deploying the application" New topic
Author

Deploying the application

meena latha
Ranch Hand

Joined: Jan 24, 2005
Posts: 219
<p>
Hi all....I am not able to deploy my application correctly.
I wrote a small application called TestingServlet.java
My project make is TestingProject and my application is under the package com.elite.servlet.
To be more clear the structure is like this

TestingProject(ProjectName)
|-
WEB_INF/src
|-
com.elite.servlet
|-
TestingServlet.java

Now how should i use the web.xml
<servlet>
<servlet-name>TestingServlet</servlet-name><br>
<servlet-class>TestingServlet</servlet-class><br>
</servlet>
<servlet-mapping>
<servlet-name>TestingServlet</servlet-name><br>
<url-pattern>???</url-pattern><br>
</servlet-mapping>

My doubt is how should i give my url-patter.
And how should i invoke in my browser
Please Help me to clear my doubt.
Thanks in advance
Ramya
Gert Cuppens
Ranch Hand

Joined: Jul 13, 2003
Posts: 87
I'll give you as an example my own web.xml.
This web.xml tells Tomcat how to work with my web application
called gco. So, in my Tomcat folder, I have a folder C:\Program Files\Apache Software Foundation\Tomcat 5.0\webapps\gco.

Inside the WEB-INF folder of this web application "gco" is the web.xml and it contains the following code

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

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

<web-app>
<display-name>CLUIF</display-name>
<description>CLUb op het Internet voor Filmfanaten</description>
<servlet>
<servlet-name>LoggerServlet</servlet-name>
<servlet-class>org.gertcuppens.controller.LoggerServlet</servlet-class>
<init-param>
<param-name>properties</param-name>
<param-value>WEB-INF\classes\log4j.properties</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>

<servlet>
<servlet-name>org.gertcuppens.controller.CluifController</servlet-name>
<servlet-class>org.gertcuppens.controller.CluifController</servlet-class>
</servlet>
<servlet>
<servlet-name>org.gertcuppens.controller.ImageServlet</servlet-name>
<servlet-class>org.gertcuppens.controller.ImageServlet</servlet-class>
</servlet>


<servlet-mapping>
<servlet-name>org.gertcuppens.controller.CluifController</servlet-name>
<url-pattern>/cluif</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>org.gertcuppens.controller.ImageServlet</servlet-name>
<url-pattern>/cluifimg</url-pattern>
</servlet-mapping>



</web-app>

The most important servlet is CluifController.
With the following lines I tell Tomcat to which class belongs this Cluifcontroller. In my case, I've been too lazy to give a different name; so Class and name are the same.

<servlet>
<servlet-name>org.gertcuppens.controller.CluifController</servlet-name>
<servlet-class>org.gertcuppens.controller.CluifController</servlet-class>
</servlet>

And which URL should be used to invoke this servlet ?
<servlet-mapping>
<servlet-name>org.gertcuppens.controller.CluifController</servlet-name>
<url-pattern>/cluif</url-pattern>
</servlet-mapping>


So, when I start Tomcat on my PC with http://localhost:8080, I get
the default start screen of Tomcat. To invoke my web application I have to write http://localhost:8080/gco/cluif.

With /gco, Tomcat knows it has to look for the web.xml inside the gco-folder. And with /cluif, Tomcat knows it has to start the servlet called org.gertcuppens.controller.CluifController.
D Rog
Ranch Hand

Joined: Feb 07, 2004
Posts: 472

I use something like
<url-pattern>/iwantyoucall*</url-pattern>

In this case I can reach it:
<a href="http://host/warname/<b rel="nofollow">iwantyoucall</b>something/somestring??some=parameters" target="_blank">http://host/warname/iwantyoucallsomething/somestring??some=parameters


Retire your iPod and start with HD Android music player Kamerton | Minimal J2EE container is here | Light weight full J2EE stack | and build tool | Co-author of "Windows programming in Turbo Pascal"
meena latha
Ranch Hand

Joined: Jan 24, 2005
Posts: 219
Thanks....
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Deploying the application
 
Similar Threads
problem with servlets
getServletContext() gives NullPointerException
doubt in forwarding
Executing my first servlet program
Tomcat 404 error