aspose file tools*
The moose likes Servlets and the fly likes Servlet @WebServlet url patterns Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Servlet @WebServlet url patterns" Watch "Servlet @WebServlet url patterns" New topic

Servlet @WebServlet url patterns

malik ge
Ranch Hand

Joined: May 13, 2011
Posts: 69
In the following code:

The @WebServlet annotation defines two urlPatterns signIn and signUp.
I want to know, is it possible if:

  • signIn is passed then servlet should perform some task,
  • and if signUp is passed then some other functionality is performed, other than sign-In's functionality

  • Ulf Dittmer

    Joined: Mar 22, 2005
    Posts: 39576
    You could call HttpServletRequest.getRequestURL to determine which URL was actually called.

    Ping & DNS - updated with new look and Ping home screen widget
    malik ge
    Ranch Hand

    Joined: May 13, 2011
    Posts: 69
    I agree. Here's the link:
    subject: Servlet @WebServlet url patterns
    Similar Threads
    Servlets access directly.
    WAS7 for Developers & annotations
    Servlet 3.0 and URL Patterns with wildcards.
    Can we make a web application without using web.xml
    How to Start a service automatically when the tomcat starts?