This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Servlets and the fly likes Servlet's web.xml Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Servlet Watch "Servlet New topic
Author

Servlet's web.xml

Gaurav Chhabras
Ranch Hand

Joined: Sep 21, 2005
Posts: 126
Hello

I have created one servlet named firstServlet and put it in package com.mail
in web.xml i have written

<servlet>
<servlet-name>firstServlet</servlet-name>
<servlet-class>com.mail.firstServlet</servlet-class>
</servlet>

but when i run that , then it will give the error that page not found.

Please rectify me.

Thanks
Regards
Gaurav
Christophe Verré
Sheriff

Joined: Nov 24, 2005
Posts: 14687
    
  16

Could you please also post your <servlet-mapping> ?


[My Blog]
All roads lead to JavaRanch
Nirav Patel
Greenhorn

Joined: May 27, 2005
Posts: 22
Hi,
Also, It's good practice to start java class with Capital letter. Like "FirstServlet". Only package names should start with small letter.

Just a code convention; good practice


----<br />Nirav Patel<br />Software is the bottleneck in the digital world!
Adeel Ansari
Ranch Hand

Joined: Aug 15, 2004
Posts: 2874
Originally posted by Nirav Patel:
Only package names should start with small letter.


Its better and correct if we say, every word in a class name should start with a capital letter, according to naming convention. e.g. FirstServlet, LastFilter. . . etc.
Leslic Chan
Greenhorn

Joined: Nov 21, 2005
Posts: 2
you should add this

<servlet-mapping>
<servlet-name>your class</servlet-name>
<url-pattern>/yourclassname</url-pattern>
</servlet-mapping>
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Servlet's web.xml