GeeCON Prague 2014*
The moose likes Tomcat and the fly likes doubt in run the servlet in tomcat 5.5 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Products » Tomcat
Bookmark "doubt in run the servlet in tomcat 5.5" Watch "doubt in run the servlet in tomcat 5.5" New topic
Author

doubt in run the servlet in tomcat 5.5

joseph prabhu
Ranch Hand

Joined: Feb 26, 2008
Posts: 162
hello joseph here

In the classes folder i have servlet called lifecycle, which i compiled and have lifecycle.class file.

how to run. i request the url as

[URL=http://localhost:8080/website/lifecycle[/url]

it gives 404 error.
Shahnawaz Shakil
Ranch Hand

Joined: Aug 04, 2008
Posts: 57
If you want to run the servlet directly by typing url in the address bar then the servlet should support doGet method. Secondly the url should be in accordance with the url-pattern tag of servlet mapping in web.xml
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

Have you mapped the servlet in your web.xml file as, If not then look at this !


[LEARNING bLOG] | [Freelance Web Designer] | [and "Rohan" is part of my surname]
joseph prabhu
Ranch Hand

Joined: Feb 26, 2008
Posts: 162
where i can find the web.xml . did i have to write explicity in the WEB-INF directory.
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

Yes, you have to ! Its in WEB-INF/web.xml
joseph prabhu
Ranch Hand

Joined: Feb 26, 2008
Posts: 162
without the web.xml the jsp program are running.

did i have to write the web.xml. for this . is there any way to create the web.xml automatically.
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

Yes, when we request the .jsp pages, its get compiled and retrued by servlet container to browser.

But the servlets are mapped by the URL pattern to actual stored Servlet class

e.g



Here is the basic web.xml file from tomcat
joseph prabhu
Ranch Hand

Joined: Feb 26, 2008
Posts: 162
is any command to create the web.xml automatically as like in weblogic server
Sagar Rohankar
Ranch Hand

Joined: Feb 19, 2008
Posts: 2902
    
    1

No, as far as my knowledge is concerned there is no command to build web.xml from tomcat server, but you can use build tools like Ant and there are IDE like Netbeans which add the entry of each new Servlet class you creates !

But I suggest you crate or write the web.xml elements yourself, that makes your basic clears and helps in understanding the things !
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: doubt in run the servlet in tomcat 5.5