when i deployed servlet in tomcat , and i put the this code as bellowed to Web.xml and and i run it in the web browser , it show error "The requested resource (/ServletProduct/product) is not available." , So what is the problem on this configure , I am sorry for this question because I am first servlet and tomcat
<servlet>
<servlet-name>My</servlet-name>
<servlet-class>hall.ThreeParam</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>My</servlet-name>
<url-pattern>/product</url-pattern>
</servlet-mapping>
Is "ServletProduct" the correct name of your context? Remember, case counts; Servletproduct is not the same as ServletProduct.
Make sure hall.ThreeParam is the correct package and class name. Again, case matters.
Check the catalina.out file for a exception trace that might be thrown when the container tries to instantiate your servlet. Make sure the servlet doesn't have any empty catch blocks or you won't get the stack trace.
"There is no reason for any individual to have a computer in his home" ~ Ken Olson, Co-founder of DEC, 1977
meas chan
Greenhorn
Joined: Mar 08, 2012
Posts: 4
posted
0
But when i change "/product" in <url-pattern> to "*.extesion" , it will not error while i run it on browser , what is problem ?
meas chan wrote:I am sorry , i do not where is app-context , please guide me at this point
The context is best described as the folder (under /webapps on Tomcat) where your application is deployed. If you are deploying with a .war file, Tomcat will create a folder with the same name as the .war file. It's also known as the document root. In your case, it appears that what you are going for is http://ServletProduct/product, in which case ServletProduct is the context.
It sounds as if you need to get some background on the basics of web application deployment. I recommend the book Head First Servlets and JSP.