• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

doubt in run the servlet in tomcat 5.5

 
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
Ranch Hand
Posts: 57
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have you mapped the servlet in your web.xml file as, If not then look at this !
 
joseph prabhu
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
where i can find the web.xml . did i have to write explicity in the WEB-INF directory.
 
Sagar Rohankar
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, you have to ! Its in WEB-INF/web.xml
 
joseph prabhu
Ranch Hand
Posts: 162
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 162
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
is any command to create the web.xml automatically as like in weblogic server
 
Sagar Rohankar
Ranch Hand
Posts: 2908
1
Spring Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 !
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic