jdk/test/com/sun/jdi/sde/TemperatureTableServlet.java
author duke
Sat, 01 Dec 2007 00:00:00 +0000
changeset 2 90ce3da70b43
permissions -rw-r--r--
Initial load
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
//@file TemperatureTable.jsp /nodynamiccopyright/ hard coded linenumbers in other tests - DO NOT CHANGE
90ce3da70b43 Initial load
duke
parents:
diff changeset
     2
import java.io.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
import java.util.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
// import javax.servlet.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
// import javax.servlet.http.*;
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
90ce3da70b43 Initial load
duke
parents:
diff changeset
     7
public class TemperatureTableServlet /* extends HttpServlet */{
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
        public static void main(String[] args) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
     9
//      public void doGet(HttpServletRequest request, HttpServletResponse response)
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
//              throws IOException, ServletException {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
                HelloWorld.main(args); // so we can we non-JSP code too
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
                PrintStream out = System.out;
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
//              response.setContentType("text/html");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
//              PrintWriter out = response.getWriter();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
//@line 1
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
                out.println("<html>");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
//@line 2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
                out.println("<head>");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
//@line 3
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
                out.println("   <title>Temperature Table</title>");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    21
//@line 4
90ce3da70b43 Initial load
duke
parents:
diff changeset
    22
                out.println("</head>");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    23
//@line 5
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
                out.println("<body>");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
//@line 6
90ce3da70b43 Initial load
duke
parents:
diff changeset
    26
                out.println("");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    27
//@line 7
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
                out.println("<h1>Temperature Table</h1>");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    29
//@line 8
90ce3da70b43 Initial load
duke
parents:
diff changeset
    30
                out.println("<p>American tourists visiting Canada can use this handy temperature");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    31
//@line 9
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
                out.println("table which converts from Fahrenheit to Celsius:");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    33
//@line 10
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
                out.println("<br><br>");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
//@line 11
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
                out.println("");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    37
//@line 12
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
                out.println("<table BORDER COLS=2 WIDTH=\"20%\" >");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
//@line 13
90ce3da70b43 Initial load
duke
parents:
diff changeset
    40
                out.println("<tr BGCOLOR=\"#FFFF00\">");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
//@line 14
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
                out.println("<th>Fahrenheit</th>");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    43
//@line 15
90ce3da70b43 Initial load
duke
parents:
diff changeset
    44
                out.println("<th>Celsius</th>");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
//@line 16
90ce3da70b43 Initial load
duke
parents:
diff changeset
    46
                out.println("</tr>");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
//@line 17
90ce3da70b43 Initial load
duke
parents:
diff changeset
    48
                out.println("");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    49
//@line 18
90ce3da70b43 Initial load
duke
parents:
diff changeset
    50
                for (int i = 0; i <= 100; i += 10) {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    51
//@line 19
90ce3da70b43 Initial load
duke
parents:
diff changeset
    52
                        out.println("<tr ALIGN=RIGHT BGCOLOR=\"#CCCCCC\">");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    53
//@line 20
90ce3da70b43 Initial load
duke
parents:
diff changeset
    54
                        out.println("<td>" + i + "</td>");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    55
//@line 21
90ce3da70b43 Initial load
duke
parents:
diff changeset
    56
                        out.println("<td>" + ((i - 32) * 5 / 9) + "</td>");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    57
//@line 22
90ce3da70b43 Initial load
duke
parents:
diff changeset
    58
                        out.println("</tr>");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    59
//@line 23
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
                }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
//@line 24
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
                out.println("");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
//@line 25
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
                out.println("</table>");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
//@line 26
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
                out.println("<p><i>Created " + new Date () + "</i></p>");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
//@line 27
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
                out.println("");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
//@line 28
90ce3da70b43 Initial load
duke
parents:
diff changeset
    70
                out.println("</body>");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    71
//@line 29
90ce3da70b43 Initial load
duke
parents:
diff changeset
    72
                out.println("</html>");
90ce3da70b43 Initial load
duke
parents:
diff changeset
    73
        }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    74
}