Results 1 to 4 of 4
  1. #1
    pretep is offline Member
    Join Date
    Sep 2015
    Posts
    3
    Rep Power
    0

    Default @WebServlet-URL - Problems with '/'

    Hi everyone!
    after creating a new project ("Dynamic web project") in eclipse (mars) I added some Servlets.Deploying to Glassfish server (4.1, Ubuntu linux) works for

    Java Code:
    @WebServlet("/user_edit")
    public class UserServlet extends HttpServlet {
    	private static final long serialVersionUID = 1L;
    ...
    But changing the urlPattern-Parameter to '/user/edit' results in an error-message:

    HTTP Status 404 - Not Found
    type Status report
    message Not Found
    description The requested resource is not available.
    Naming the parameters for @WebServlet makes no difference - still the same message. I did not make any changes to web.xml and others...
    Browser called "correct" url: http://localhost:8080/project/user/edit.

    Does anyone have an idea how to solve my problem?? It's really just the change from '_' to '/'...

    Thanks in advance, pretep
    Last edited by pretep; 09-02-2015 at 08:47 PM.

  2. #2
    RamyaSivakanth's Avatar
    RamyaSivakanth is offline Senior Member
    Join Date
    Apr 2009
    Location
    Chennai
    Posts
    878
    Rep Power
    11

    Default Re: @WebServlet-URL - Problems with '/'

    in web.xml

    pls check the URL Pattern in the below node

    <servlet-mapping>
    </servlet-mapping>
    Ramya:cool:

  3. #3
    pretep is offline Member
    Join Date
    Sep 2015
    Posts
    3
    Rep Power
    0

    Default Re: @WebServlet-URL - Problems with '/'

    Quote Originally Posted by RamyaSivakanth View Post
    in web.xml

    pls check the URL Pattern in the below node
    that file does not exist at all. My WEB_INF -folder just contains glassfish-web.xml:

    <?xml version="1.0" encoding="UTF-8"?>

    Java Code:
    <!DOCTYPE glassfish-web-app PUBLIC "-//GlassFish.org//DTD GlassFish Application Server 3.1 Servlet 3.0//EN" "http://glas...
    <glassfish-web-app>
        <context-root>/project</context-root>
    </glassfish-web-app>
    Greetz, pretep

  4. #4
    pretep is offline Member
    Join Date
    Sep 2015
    Posts
    3
    Rep Power
    0

    Default Re: @WebServlet-URL - Problems with '/'

    Quote Originally Posted by pretep View Post
    Does anyone have an idea how to solve my problem?? It's really just the change from '_' to '/'...
    Wow - I fixed my problem. It had to do with paths - but not the path of my route - but the path of my JSP-file I forwarded to. On adding an '/' to the beginning of the filename (line 6) the "resource was found"..

    Java Code:
    @WebServlet("/user/edit")
    public class UserServlet extends HttpServlet {
    
    [...]
    
    		final RequestDispatcher dispatcher = request.getRequestDispatcher("/user_list.jsp");
    		dispatcher.forward(request, response);
    Forwading just to "user_liste.jsp" results in an error - described above...

    Thank you all for watching... pretep

Similar Threads

  1. need help with several problems
    By tidus1103 in forum New To Java
    Replies: 4
    Last Post: 03-11-2011, 01:10 AM
  2. InputStream/Jar Problems/File IO Problems
    By rdjava in forum Advanced Java
    Replies: 31
    Last Post: 01-17-2011, 11:12 AM
  3. Gui problems
    By bulldog in forum Advanced Java
    Replies: 1
    Last Post: 12-11-2009, 12:35 PM
  4. Few Problems Help!
    By elad_bj in forum New To Java
    Replies: 4
    Last Post: 04-07-2009, 03:45 AM
  5. many to many problems
    By cecily in forum JDBC
    Replies: 1
    Last Post: 08-02-2007, 05:51 PM

Tags for this Thread

Posting Permissions

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