title: @WebServlet annotation with Tomcat 7
body: <p>In my application, I had a servlet which was defined like this in the <em>web.xml</em>:</p>
  
  <pre class="lang-xml prettyprint-override"><code>&lt;servlet&gt;
      &lt;display-name&gt;Notification Servlet&lt;/display-name&gt;
      &lt;servlet-name&gt;NotificationServlet&lt;/servlet-name&gt;
      &lt;servlet-class&gt;com.XXX.servlet.NotificationServlet&lt;/servlet-class&gt;
      &lt;load-on-startup&gt;1&lt;/load-on-startup&gt;
  &lt;/servlet&gt;
  &lt;servlet-mapping&gt;
      &lt;servlet-name&gt;NotificationServlet&lt;/servlet-name&gt;
      &lt;url-pattern&gt;/notification/*&lt;/url-pattern&gt;
  &lt;/servlet-mapping&gt;
  </code></pre>
  
  <p>After moving to use Tomcat 7, I would like to use the <code>@WebServlet</code> annotation that will do the job.<br>
  Here is the way I did it:</p>
  
  <pre><code>@WebServlet( name="NotificationServlet", displayName="Notification Servlet", urlPatterns = {"/notification"}, loadOnStartup=1)
  public class NotificationServlet extends HttpServlet {
  </code></pre>
  
  <p>And it does not work.
  Could someone please tell me what I did wrong?</p>