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

web.xml

gaurav chhabra
Ranch Hand

Joined: Jul 24, 2004
Posts: 109
thanks to all of you for your support

i have my directory structure of my web application is-----::::

C:\Program Files\Apache Group\Tomcat 4.1\HelloClientServlet\

under it i have made the two folders -:
1-) META-INF
2-) WEB-INF

my program name is HelloClientServlet

so what to give in the following syntax of following web.xml file.....

<servlet>
<servlet-name>HelloClientServlet</servlet-name>
<servlet-class></servlet-class> (what path i have to give here , should i will give where i have save up my class file of HelloClientServlet i.e C:\Program Files\Apache Group\Tomcat 4.1\HelloClientServlet\WEB-INF\classes)

please tell me the solution
thank you
gaurav
</servlet>
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61766
    
  67

Have you looked at the sample applications that come with Tomcat? They're full of examples.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
ramprasad madathil
Ranch Hand

Joined: Jan 24, 2005
Posts: 489

give the fully qualified path to your servlet.
You servlet.class file should be in the classes dir under WEB-INF.

<servlet>
<servlet-name>LoginServlet</servlet-name>
<servlet-class>com.my.servlet.LoginServlet</servlet-class>
</servlet>

where LoginServlet.class is in WEB-INF/classes/com/my/servlet directory.

btw, please read up the documentation/examples as mentioned in the prev post.

tx,
ram.
gaurav chhabra
Ranch Hand

Joined: Jul 24, 2004
Posts: 109
thanks for your reply

i have my program(HelloClientServlet.class) in
\root\HelloClientServlet\WEB-INF\classes\

so i have used only HelloClientServlet in <servlet-class> i.e

<servlet-class>HelloClientServlet</servlet-class>
is it ok.

in mapping the below syntax is right or not ---->>>

<servlet-mapping>
<servlet-name>HelloClientServlet</servlet-name>
<url-pattern>jaishriram</url-pattern>
</servlet-mapping>

if something wrong there then please guideme that what should be written at that place

thank you
gaurav
ramprasad madathil
Ranch Hand

Joined: Jan 24, 2005
Posts: 489

I think it would be best for you to go thru these resources -
1.http://jakarta.apache.org/tomcat/tomcat-4.1-doc/appdev/introduction.html.
2.http://www.onjava.com/pub/a/onjava/2001/04/19/tomcat.html

That way, you would learn a lot more than somebody hand holding you thru the steps of setting up a j2ee web application on tomcat. Believe me, that's how the people who reply to your posts learnt it :-)

ok this is how u map the servlet to a url.

<servlet>
<servlet-name>LoginServlet</servlet-name>
<servlet-class>com.my.servlet.LoginServlet</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>LoginServlet</servlet-name>
<url-pattern>/login</url-pattern>
</servlet-mapping>.

Now if your web-context is say 'test', then
http://machinename ort/test/login would invoke LoginServlet. Please do readup the resources.

ram.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: web.xml