I have a big doubt here, I have the simplest deploys file ever.
the application is in the tomcat's webapps directory like this : tomcat |- webapps |- mytest |- WEB-INF ....
and I try to access this with my browser with the URL : http://localhost:8080/mytest/MyWerver, but this fails. It seams that i can not access a servlet by using its name. The only ways to access the servlet is tu use a servlet-mapping node. So my question is : It is possible to access a Servlet by using (only) its name ?
this is a discouraged practice and most web containers do not allow this by default. Using a serlvet mapping is the standard.
Mihai Radulescu
Ranch Hand
Joined: Sep 18, 2003
Posts: 912
posted
0
Hi Michael,
Thanks for your answer, but I still have one question how I can configurate the container to allow this ?
Regards, M
Michael Ku
Ranch Hand
Joined: Apr 20, 2002
Posts: 510
posted
0
When you said by name I thought you wanted to access the servlet by class name (which is discouraged)
You need to add a servlet maping to match your servlet name entry. I have supplied some of these pairs for you to look at. Notice each servlet tag has a corresponding servlet-mapping tag. It is the servlet-name tag that ties them together. Then you can access the servlet by using the url-mapping pattern. For example, the pattern host/web root/jstltest will match the <url-pattern>/jstltest</url-pattern> which is tied to <servlet-name>JSTLTagTestServlet</servlet-name> which is tied to the actual class <servlet-class>com.sparky.servlet.JSTLTagTestServlet</servlet-class> </servlet>