source: nutchez-0.1/tomcat/webapps/examples/WEB-INF/classes/HelloWorldExample.java @ 108

Last change on this file since 108 was 66, checked in by waue, 15 years ago

NutchEz - an easy way to nutch

File size: 2.5 KB
RevLine 
[66]1/*
2* Licensed to the Apache Software Foundation (ASF) under one or more
3* contributor license agreements.  See the NOTICE file distributed with
4* this work for additional information regarding copyright ownership.
5* The ASF licenses this file to You under the Apache License, Version 2.0
6* (the "License"); you may not use this file except in compliance with
7* the License.  You may obtain a copy of the License at
8*
9*     http://www.apache.org/licenses/LICENSE-2.0
10*
11* Unless required by applicable law or agreed to in writing, software
12* distributed under the License is distributed on an "AS IS" BASIS,
13* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14* See the License for the specific language governing permissions and
15* limitations under the License.
16*/
17/* $Id: HelloWorldExample.java 500674 2007-01-27 23:15:00Z markt $
18 *
19 */
20
21import java.io.*;
22import java.util.*;
23import javax.servlet.*;
24import javax.servlet.http.*;
25
26/**
27 * The simplest possible servlet.
28 *
29 * @author James Duncan Davidson
30 */
31
32public 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  // note that all links are created to be relative. this
54  // ensures that we can move the web application that this
55  // servlet belongs to to a different place in the url
56  // tree and not have any harmful side effects.
57
58        // XXX
59        // making these absolute till we work out the
60        // addition of a PathInfo issue
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
Note: See TracBrowser for help on using the repository browser.