This week's book giveaway is in the Mac OS forum. We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line! See this thread for details.
Hi I am done some programming in jsp and now started trying my hand in servlets. But i am unable to make my servlets run. I am using tomcat 4.0.6 as server. I have a JSP page which specifies name of a servlet in its action. <form name="shoppingForm" action="/servlet/ShoppingServlet" method="POST"> Then in the WEB-INF/classes/servlet directory i have made a servlet called ShoppingServlet. These are my entries in web.xml <servlet> <servlet-name>ShoppingServlet</servlet-name> <servlet-class>servlet.ShoppingServlet</servlet-class> </servlet> <servlet-mapping> <servlet-name>ShoppingServlet</servlet-name> <url-pattern>/servlet/servlet.ShoppingServlet</url-pattern> </servlet-mapping>
But when i submit the form i get the error: page does not exist
here you have specified the url pattern "/servlet/servlet.ShoppingServlet" and you are accessing servlet using "/servlet/ShoppingServlet" Change your entry in web.xml of url-pattern. change it to following <servlet-mapping> <servlet-name>ShoppingServlet</servlet-name> <url-pattern>/servlet/ShoppingServlet</url-pattern> </servlet-mapping> Now try it will run.
No no no - don't use /servlet/ - this gets you mixed up in the dreaded "invoker" servlet syntax - the cause of about 75% of all new programmer confusion. See this ranch FAQ on the invoker servlet. Also many many discussions on this and the Tomcat forum in recent weeks. Bill