Forums Register Login

Servlet call error: 404 servlet call not available

+Pie Number of slices to send: Send
hi guys,

i have a question relating to servlet call.
I am using tomcat for my server.
I am calling a servlet from a html form action
as follows -

<form method="get" action="/myapplication/MyServlet">
<Input types -- >
<-- different input types here--->
< --------->

<input type="submit">
</form>


where myapplication is the name of my folder kept in webapps of Tomcat.

My servlet is kept in WEB-INF/classes, I have not used any package to keep the servlet in, it is directly inside classes.
My deployment discriptor ie web.xml is kept in WEB-INF.

the url mapping is -

<servlet-name>MyServlet</servlet-name>
<servlet-class>MyServlet</servlet-class>


<url-pattern>MyServlet</url-pattern>


but still when I press submit on my html page it gives 404 error and says /myapplication/MyServlet is not available.

please help.

Thanks in advance.
+Pie Number of slices to send: Send
Please check the DOCBASE property of your application in the file of server.xml which is available in YOUR_TOMCAT_FOLDER/conf.
Without that the server can not find your application.

good luck (- -)V
+Pie Number of slices to send: Send
 

I have not used any package to keep the servlet in,


Experience suggests that this is a bad idea. Just do that little bit of extra effort, put ALL classes used with servlets in a package, and avoid many mysterious bugs.
Bill
+Pie Number of slices to send: Send
I assume these are exerpts from your deployment descrptor and that you've
got full <servlet> and <servlet-mapping> entries.



Try changing
<url-pattern>MyServlet</url-pattern>
to
<url-pattern>/MyServlet</url-pattern>
When I was younger I felt like a man trapped inside a woman’s body. Then I was born. My twin is a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1285 times.
Similar Threads
JSP not able to find the servlet
Help Me
Head First Servlet JSP: BeerSelect example: requested resource not available
Deploying My WebApp in Tomcat
Calling a servlet from a html page
More...

All times above are in ranch (not your local) time.
The current ranch time is
Apr 16, 2024 00:42:50.