Biblioteca Java - Blame information for rev 19
Subversion Repositories:
Rev | Author | Line No. | Line |
---|---|---|---|
19 | mihai | 1 | package exemple.scd.web; |
2 | |||
3 | import java.io.IOException; | ||
4 | import java.io.PrintWriter; | ||
5 | |||
6 | import javax.servlet.ServletException; | ||
7 | import javax.servlet.annotation.WebServlet; | ||
8 | import javax.servlet.http.HttpServlet; | ||
9 | import javax.servlet.http.HttpServletRequest; | ||
10 | import javax.servlet.http.HttpServletResponse; | ||
11 | |||
12 | /** | ||
13 | * Servlet implementation class HelloWorldServlet | ||
14 | */ | ||
15 | @WebServlet(name = "hello", urlPatterns = { "/hello" }) | ||
16 | public class HelloWorldServlet extends HttpServlet { | ||
17 | private static final long serialVersionUID = 1L; | ||
18 | |||
19 | int counter = 0; | ||
20 | /** | ||
21 | * @see HttpServlet#HttpServlet() | ||
22 | */ | ||
23 | public HelloWorldServlet() { | ||
24 | super(); | ||
25 | // TODO Auto-generated constructor stub | ||
26 | } | ||
27 | |||
28 | /** | ||
29 | * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response) | ||
30 | */ | ||
31 | protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { | ||
32 | counter++; | ||
33 | response.setContentType("text/html"); | ||
34 | PrintWriter out = response.getWriter(); | ||
35 | out.println("<html>"); | ||
36 | out.println("<head>"); | ||
37 | out.println("<title>Hello World!</title>"); | ||
38 | out.println("</head>"); | ||
39 | out.println("<body>"); | ||
40 | out.println("<h1>Hello World!</h1>"); | ||
41 | out.println("<h3>You are visitor number:"+counter+"</h3>"); | ||
42 | out.println("</body>"); | ||
43 | out.println("</html>"); | ||
44 | } | ||
45 | |||
46 | /** | ||
47 | * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response) | ||
48 | */ | ||
49 | protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { | ||
50 | // TODO Auto-generated method stub | ||
51 | } | ||
52 | |||
53 | } |