Created
January 12, 2012 23:51
-
-
Save keesun/1603893 to your computer and use it in GitHub Desktop.
Servlet 3.0's Annotation based Servlet registration sample
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@WebServlet(urlPatterns = "/test") | |
public class TestServlet extends HttpServlet { | |
@Override | |
protected void doGet(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { | |
res.setContentType(MediaType.TEXT_PLAIN_VALUE); | |
PrintWriter out = res.getWriter(); | |
out.write("Hello"); | |
out.close(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment