I was able to display html form then suddenly due to some misconfiguration or something
the app start giving 404 error
attached is my app directory structure , tomcat is running fine
here is web.xml
I reinstalled tomcat and again do all the steps, I put form.html in webapps folder and put class and stuff in WEB-INF folder , but I didn't put web.xml there(I forgot to do so)
then first time form.html loads and on submit it says /Selection.do (fair enough)
but then when I again reload form.html it gives 404 error
And what happens if you remove the space in the servlet name?
servlet-names can have spaces there is no problem to add spaces in your servlet names.
your closing tag <web-app> should be </web-app> may be this would resolve your problems
Omar Al Kababji - Electrical & Computer Engineer
[SCJP - 90% - Story] [SCWCD - 94% - Story] [SCBCD - 80% - Story] | My Blog
vaibhav mishra
Ranch Hand
Joined: Jun 18, 2008
Posts: 168
posted
0
I did it ( although HFSJ have a space ) and no luck
I also fixed the lack of slash in closing servlet-mapping tag and web-app
new web.xml is
even form.html is not loading
Omar Al Kababji
Ranch Hand
Joined: Jan 13, 2009
Posts: 357
posted
0
I put form.html in webapps folder and put class and stuff in WEB-INF folder , but I didn't put web.xml there(I forgot to do so)
you should have a directory in your webapps with a name for you web application for example "myWebApp" and then when you call form.html you should call
http://localhost:8080/myWebApp/form.html
omar al kababji wrote:you should have a directory in your webapps with a name for you web application for example "myWebApp" and then when you call form.html you should call
http://localhost:8080/myWebApp/form.html
your structure should be like this
If you look at the image included in the start post you'll see that the application name is beer and that the files are all in the right place.
Besides the link, what is in the output and error logs of your Tomcat? A 404 error for static content could indicate an error in your web.xml
vaibhav mishra
Ranch Hand
Joined: Jun 18, 2008
Posts: 168
posted
0
This is my current web.xml
@Jonathan
I cannot submit the form, and that static form.html is having 404 error
I am having same exact configuration as given in book.
Omar Al Kababji
Ranch Hand
Joined: Jan 13, 2009
Posts: 357
posted
0
your form.html file is inside the WEB-INF directory this is wrong it should be raised up by one level, it should be a sibling for the WEB-INF directory ;). compare my file structure and yours again.
then the most obvious answer is that your application isn't deployed.
check the log of tomcat (in logs folder of tomcat, the last modified)
to see what's the problem.
besides, maybe it's the hyphen (-) that doing this problem, try deploying
the application without the hyphen (Beer_v1 for example)
vaibhav mishra
Ranch Hand
Joined: Jun 18, 2008
Posts: 168
posted
0
Edit:Got it running finally
it seems that web.xml was corrupted somehow,
I redo all the modifications again and it is running fine showing off the output
Thanks guys for hearing me out
original message:
omar al kababji wrote:your form.html file is inside the WEB-INF directory this is wrong it should be raised up by one level, it should be a sibling for the WEB-INF directory ;). compare my file structure and yours again.
it's a sibling , the picture showed it that way.
and here is my 404 error which I received previously, but all is working fine now
@Jonathan
HFSJ clearly show a hyphen, so I think it should not be a problem
vaibhav mishra wrote:it seems that web.xml was corrupted somehow
Rob Prime wrote:Besides the link, what is in the output and error logs of your Tomcat? A 404 error for static content could indicate an error in your web.xml