1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20 import java.io.*;
21 import java.text.*;
22 import java.util.*;
23 import javax.servlet.*;
24 import javax.servlet.http.*;
25
26 /**
27 * The simplest possible servlet.
28 *
29 * @author James Duncan Davidson
30 */
31
32 public class HelloWorldExample extends HttpServlet {
33
34
35 public void doGet(HttpServletRequest request,
36 HttpServletResponse response)
37 throws IOException, ServletException
38 {
39 ResourceBundle rb =
40 ResourceBundle.getBundle("LocalStrings",request.getLocale());
41 response.setContentType("text/html");
42 PrintWriter out = response.getWriter();
43
44 out.println("<html>");
45 out.println("<head>");
46
47 String title = rb.getString("helloworld.title");
48
49 out.println("<title>" + title + "</title>");
50 out.println("</head>");
51 out.println("<body bgcolor=\"white\">");
52
53
54
55
56
57
58
59
60
61
62 out.println("<a href=\"../helloworld.html\">");
63 out.println("<img src=\"../images/code.gif\" height=24 " +
64 "width=24 align=right border=0 alt=\"view code\"></a>");
65 out.println("<a href=\"../index.html\">");
66 out.println("<img src=\"../images/return.gif\" height=24 " +
67 "width=24 align=right border=0 alt=\"return\"></a>");
68 out.println("<h1>" + title + "</h1>");
69 out.println("</body>");
70 out.println("</html>");
71 }
72 }
73
74
75