Need to write url-pattern, which is correctly written in the second case.
Also this caught my eye HTML- <form method="GET" action = "/BeerV1/Select.do"> change to <form method="GET" action = "Select.do"> - as the context would be added by the web container.
XML <uri-pattern>/BeerV1/Select.do</uri-pattern> change to <url-pattern>/Select.do</url-pattern>
Hope this helps
Joined: Mar 15, 2007
An add-on HTML- <form method="GET" action = "/BeerV1/Select.do"> could be BeerV1/Select.do as it is just a URL pattern (as long as web.xml also uses the same URL PATTERN) <form method="GET" action = "BeerV1/Select.do"> - Remove "/" forward slash
which would make the web.xml
<uri-pattern>/BeerV1/Select.do</uri-pattern> change to <url-pattern>/BeerV1/Select.do</url-pattern>
However, if your servlet forwards the result to a JSP, then the JSP would need to be under an additional BeerV1 folder
So directory structure would be:- C:\tomcat\Tomcat 5.5\webapps\BeerV1\form1.html C:\tomcat\Tomcat 5.5\webapps\BeerV1\WEB-INF\web.xml C:\tomcat\Tomcat 5.5\webapps\BeerV1\WEB-INF\classes\example1\SelectBeer.class C:\tomcat\Tomcat 5.5\webapps\BeerV1\BeerV1\<JSP Page>
Joined: Apr 20, 2007
sorry guys i forgot to mention that Error :404 in coming for case 1) form1.html itself and servlet-mapping comes later
here it is
i have webapps----------->jsp-examples | | | |-------------->servlet-examples | |------->BeerV1
"/jsp-examples" comes with tomcat by default so no problem in executing even if i write servlet/jsp under "/jsp-examples" and modify web.xml which is already there is fine...goes wel
same with "servlet.examples"
now i have my own
"BeerV1" which is peer to "jsp-examples" and "servlet-examples" as you can see in diagram
under which i have 1)/BeerV1/form1.html 2)/BeerV1/WEB-INF/web.xml 3)/BeerV1/WEB-INF/classes/SelectBeer.class
Error:404 for 1)/BeerV1/form1.html itself
so my guess is tomcat might not be getting resources under /BeerV1 how can we solve this any suggestion? also i will make sure servlet-mapping should not go wrong. Any Help ???
Joined: Mar 15, 2007
Have you tried after correcting your html file and web.xml?
When there is a problem with web.xml then your BeerV1 web application is not loaded, hence you get a 404 error on trying to access the form1.html.
Also, it is a good idea to run tomcat from command prompt using startup.bat/ startup.sh... you will see any exceptions due to web.xml on the command prompt.
Change your files and restart tomcat, you should be fine