-
JSP rename servlet
hello everyone
I started getting back into web development and used a template i found online which i recreated and used as a starting point for a webapp i'm making at work. The servlet class that was shown in the example was called login servlet with the following info in the web.xml file :
<servlet>
<display-name>LoginServlet</display-name>
<servlet-name>LoginServlet</servlet-name>
<servlet-class>Controller.LoginServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>LoginServlet</servlet-name>
<url-pattern>/LoginServlet</url-pattern>
</servlet-mapping>
I want to change what appears in the URL to just Login but whatever modifications i do in there Tomcat throws errors that it can't find the resource. One would think you can just change the display-name to Login but that does not work. I also tried changing the servlet class name and mofiying the web.xml accordingly but it seems whatever modifications i do to this file make the whole thing collapse.
Any idea what i might be doing wrong?
Thanks
Martin
-
Re: JSP rename servlet
It's the url-pattern you want to change.
Everything in the <servlet> tag is to do with the Java code and not URLs.
It's the <servlet-mapping> section that actually maps from a URL to a servlet.
-
Re: JSP rename servlet
hi Tolls
Even just changing this one tag doesn't work. i changed only this line from HomeServlet to Home and i get an error 404 from Tomcat :
type Status report
message /HomeServlet
description The requested resource is not available.
-
Re: JSP rename servlet
Show us your mapping and also show us what url you are trying to go to on the page.