/Users/lyon/j4p/src/net/server/servlets/ConfirmationPage.java
|
1 package net.server.servlets;
2
3 import javax.servlet.http.HttpServletRequest;
4
5 /**
6 * The ConfirmationPage class is a type of HTML page
7 * which is used to display the results of the student
8 * assessment form, or ReviewForm. This data is displayed
9 * in a table format.
10 *
11 * @author Robert Lysik
12 * @version 1.00
13 */
14 class ConfirmationPage extends HtmlPage {
15
16 /**
17 * This is the constructor for the ConfirmationPage class.
18 * An object of type HttpServletRequest is passed in as
19 * a parameter and parsed for data pertaining to the student
20 * assessment results from the Form C page. This data is
21 * then displayed in a table format. The user is prompted
22 * to 'Proceed' at the bottom of the page, once they have
23 * reviewed the data.
24 */
25 ConfirmationPage(HttpServletRequest request) {
26 super("Confirmation Page");
27
28 String course = new String();
29 String section = new String();
30 String term = new String();
31 String year = new String();
32
33 course = request.getParameter("course");
34 section = request.getParameter("section");
35 term = request.getParameter("term");
36 year = request.getParameter("year");
37
38 addHeadline(1, "Course:");
39 addBreak();
40 addText(course + "section: " + section);
41 addBreak();
42 addHeadline(1, "Term:");
43 addBreak();
44 addText(term);
45 addBreak();
46 addHeadline(1, "Instructor:");
47 addBreak();
48 addText(request.getParameter("instructor"));
49 addBreak();
50 startForm("get",
51 "http://localhost:8080/examples/servlet/FormProcessorServlet");
52 int rowCount = Integer.parseInt(request.getParameter("rows"));
53 int colCount = Integer.parseInt(request.getParameter("cols"));
54
55 HtmlTable table = new HtmlTable(rowCount + 1, colCount, 1);
56
57 for (int rowIndex = 0; rowIndex < rowCount; rowIndex++)
58 table.setElement(rowIndex + 1,
59 0,
60 request.getParameter("student" +
61 rowIndex));
62 for (int colIndex = 0; colIndex < colCount; colIndex++)
63 table.setElement(0,
64 colIndex,
65 request.getParameter("heading" +
66 colIndex));
67 for (int rowIndex = 1; rowIndex <= rowCount; rowIndex++)
68 for (int colIndex = 1; colIndex < colCount; colIndex++)
69 table.setElement(rowIndex,
70 colIndex,
71 request.getParameter("r" +
72 rowIndex +
73 "c" +
74 colIndex));
75 addText(table.getHtml());
76 addBreak();
77 addSubmit("Proceed");
78
79 for (int rowIndex = 0; rowIndex < rowCount; rowIndex++)
80 addHidden("recordnum" + rowIndex,
81 "" + request.getParameter("recordnum" + rowIndex));
82
83 for (int rowIndex = 1; rowIndex <= rowCount; rowIndex++)
84 for (int colIndex = 1; colIndex < colCount; colIndex++)
85 addHidden("r" + rowIndex + "c" + colIndex,
86 request.getParameter("r" + rowIndex + "c" + colIndex));
87
88 addHidden("status", "confirmed");
89 addHidden("course", course);
90 addHidden("section", section);
91 addHidden("term", term);
92 addHidden("year", year);
93 addHidden("rows", "" + rowCount);
94 addHidden("cols", "" + colCount);
95 endForm();
96 }
97 }