Results 1 to 4 of 4
  1. #1
    d3n1s is offline Member
    Join Date
    Apr 2011
    Posts
    80
    Rep Power
    0

    Default 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

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    13,541
    Rep Power
    26

    Default 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 **

  3. #3
    d3n1s is offline Member
    Join Date
    Apr 2011
    Posts
    80
    Rep Power
    0

    Default 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.

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    13,541
    Rep Power
    26

    Default Re: JSP rename servlet

    Show us your mapping and also show us what url you are trying to go to on the page.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

Similar Threads

  1. Replies: 17
    Last Post: 10-22-2014, 01:02 PM
  2. How to rename GUI Title
    By rjagan in forum New To Java
    Replies: 5
    Last Post: 06-11-2014, 11:51 AM
  3. how to rename a subdirectory
    By richardzhang in forum New To Java
    Replies: 0
    Last Post: 08-10-2007, 04:28 AM
  4. How to Rename a File
    By Ada in forum New To Java
    Replies: 1
    Last Post: 05-26-2007, 12:55 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •