Mudanças Servlet 3.0 anotação @WebServlet

A especificação Servlet 3.0 facilicitou nossa vida com o uso de anotações, veja como ficou mais fácil declarar um Servlet. Agora basta dizer ao container que a classe é um Servlet:

The Servlet 3.0 specification have made our life very easy with the use of annotations, see how it’s easier to declare a Servlet. Now just tell the container that the class is a Servlet:

 
Antes/ Before:
[cc]
public class CadastroController extends HttpServlet {
//doGet, doPost, etc.
}
[/cc]
+
[cc lang=”xml”]

Um servlet muito legal
Cadastro
br.com.somedomain.controller.CadastroController


Cadastro
/cadastro

[/cc]
 
Depois/ After:
[cc]
@WebServlet(“/cadastro”)
public class CadastroController extends HttpServlet {
//doGet, doPost, etc.
}
[/cc]

 
Um grande abraço e muito sucesso!

A big hug and sucess!