• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Servlet Not Found 404

 
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,
I have created a folder nauman and placed two files index.html and NKServlet.class with NKServlet.java in this way
c:\tomcat4.1\webapps\nauman\index.html
c:\tomcat4.1\webapps\nauman\WEB-INF\classes\NKServlet.class
c:\tomcat4.1\webapps\nauman\WEB-INF\classes\NKServlet.java
c:\tomcat4.1\webapps\nauman\WEB-INF\web.xml
and I wrote web.xml
<web-app>
<servlet>
<servlet-name>NKServlet</servlet-name>
<servlet-class>NKServlet</servlet-class>
</servlet>
</web-app>
When i run the http://localhost:8080/nauman/index.html, it works fine but when i click the submit button which takes me to Servlet, It doesn't work,
It says 404 NKServlet not found. I tried to run with different way but it doesn't work
code of index.html is
<form name="Newfrm" action="servlet/NKServlet" method="POST">
<input type=submit value="submit">
</form>
I did this with href to use get method but It doesn't work.
Please help me to find where I'm making mistakes to run the servlet.
Thanks in Advance,
Nauman
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to turn on the "invoker" servlet in /conf/web.xml if you are going to use the /='servlet/class" style of URL. Search some of the recent posts for more detail.
Bill
 
Nauman Khan
Ranch Hand
Posts: 49
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Bill,My problem has been solved, I have followed your advise and it works fine but I don't want to use servlet/* .But if I comment it again and just put the action="/NKServlet", It doesn't work. If you know it please put some light on it.
Anyway I really appreciate your help.
Regards,
Nauman
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!