Results 1 to 4 of 4
Thread: JSP rename servlet
- 12-20-2016, 07:56 PM #1
Member
- Join Date
- Apr 2011
- Posts
- 80
- Rep Power
- 0
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
- 12-21-2016, 10:16 AM #2
Moderator
- Join Date
- Apr 2009
- Posts
- 13,541
- Rep Power
- 27
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.Please do not ask for code as refusal often offends.
** This space for rent **
- 12-25-2016, 03:41 PM #3
Member
- Join Date
- Apr 2011
- Posts
- 80
- Rep Power
- 0
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.
- 01-03-2017, 12:09 PM #4
Moderator
- Join Date
- Apr 2009
- Posts
- 13,541
- Rep Power
- 27
Similar Threads
-
Rename to doesn't rename the file even though it hits the code
By Fluffy93 in forum New To JavaReplies: 17Last Post: 10-22-2014, 02:02 PM -
How to rename GUI Title
By rjagan in forum New To JavaReplies: 5Last Post: 06-11-2014, 12:51 PM -
how to rename a subdirectory
By richardzhang in forum New To JavaReplies: 0Last Post: 08-10-2007, 05:28 AM -
How to Rename a File
By Ada in forum New To JavaReplies: 1Last Post: 05-26-2007, 01:55 PM
Bookmarks