Topic
1 reply Latest Post - ‏2013-12-09T17:00:59Z by rsanchezh
datacrush
datacrush
3 Posts
ACCEPTED ANSWER

Pinned topic How to create a servlet that handles sub-resources?

‏2013-12-07T01:01:13Z |

I want to create a servlet that can handle sub-resources in the URL.

For example, if I deploy a servlet at /Mypage. I want the same servlet to handle requests for /Mypage/parm1 or /Mypage/parm2. I want to manually handle parm1 and parm2 as an input using request.getServletPath(). What happens right now is that it would return 404 not found.

Any help? Thanks.

  • rsanchezh
    rsanchezh
    26 Posts
    ACCEPTED ANSWER

    Re: How to create a servlet that handles sub-resources?

    ‏2013-12-09T17:00:59Z  in response to datacrush

    You can try using wildcards in the url pattern of your servlet. For example, you can use /Mypage/* and all the requests that match that pattern will be redirected to your servlet.