• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

404 error when accessing servlet?

 
M Burke
Ranch Hand
Posts: 406
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have a jsp that calls a servlet. But when I click submit I get a 404 error from Tomcat 4.1. What am I missing?

<form action="servlet/easyRatesPkg.EasyRates" method="post">

directory...
JSP: C:\Tomcat 4.1\webapps\EasyRatesJava\outputPanel.jsp
Servlet: C:\Tomcat 4.1\webapps\EasyRatesJava\WEB-INF\classes\easyRatesPkg\EasyRates.class
 
Anthony Watson
Ranch Hand
Posts: 327
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Don't use the invoker servlet. Define the servlet and a servlet-mapping in your web.xml file and don't preface your servlet with 'servlet' in the url.
 
M Burke
Ranch Hand
Posts: 406
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well, even when I try to invoke the servlet directly, I still get a 404. There seems to be something deeper wrong.

The .class file exists in the WEB-INF/classes/easyRatesPkg dir, but this will not work
http://localhost:8080/EasyRatesJava/servlet/easyRatesPkg.EasyRates

Is there something about Tomcat that needs to be set up?
[ August 24, 2004: Message edited by: M Burke ]
 
William Brogden
Author and all-around good cowpoke
Rancher
Posts: 13074
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
http://localhost:8080/EasyRatesJava/servlet/easyRatesPkg.EasyRates

Is using the "invoker" servlet syntax - thats what Anthony was trying to call your attention to. See the invoker FAQ here at the Ranch.
Bill
 
M Burke
Ranch Hand
Posts: 406
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK, I uderstand. I added this...

<servlet-mapping>
<servlet-name>EasyRates</servlet-name>
<url-pattern>/EasyRates</url-pattern>
</servlet-mapping>

and changed the form to this...

<form action="EasyRates" method="post">



I was confused because all the examples I have invoke like this \servlet\servname
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic