This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
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 Murach's Java Servlets and JSP this week in the Servlets 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: 41043
    You could call HttpServletRequest.getRequestURL to determine which URL was actually called.

    Ping & DNS - my free Android networking tools app
    malik ge
    Ranch Hand

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