-
Notifications
You must be signed in to change notification settings - Fork 2
/
FAQ.java
98 lines (95 loc) · 3.77 KB
/
FAQ.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
import java.io.*;
import java.sql.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class FAQ extends HttpServlet
{
private ConnectionPool pool;
private ServletContext context;
private static String servletName="FAQ";
public void init()
{
context = getServletContext();
synchronized(context)
{
pool=(ConnectionPool)context.getAttribute("pool");
if(pool==null)
{
String driverClassName = context.getInitParameter("driverClassName");
String url = context.getInitParameter("url");
String userName = context.getInitParameter("username");
String password = context.getInitParameter("password");
try
{
pool=new ConnectionPool(driverClassName,url,userName,password);
}
catch(Exception error)
{
Routines.writeToLog(servletName,"Unable to create connection pool : " + error,false,context);
}
context.setAttribute("pool",pool);
}
}
}
public void doGet(HttpServletRequest request,
HttpServletResponse response)
{
response.setContentType("text/html");
PrintWriter webPageOutput=null;
try
{
webPageOutput=response.getWriter();
}
catch(IOException error)
{
Routines.writeToLog(servletName,"Error getting writer : " + error,false,context);
}
HttpSession session=request.getSession();
session.setAttribute("redirect",request.getRequestURL() + "?" + request.getQueryString());
Connection database=null;
try
{
database=pool.getConnection(servletName);
}
catch(SQLException error)
{
Routines.writeToLog(servletName,"Unable to connect to database : " + error,false,context);
}
Routines.WriteHTMLHead(null,//title
true,//showMenu
0,//menuHighLight
false,//seasonsMenu
false,//weeksMenu
false,//scores
false,//standings
false,//gameCenter
false,//schedules
false,//previews
false,//teamCenter
false,//draft
database,//database
request,//request
response,//response
webPageOutput,//webPageOutput
context);//context
pool.returnConnection(database);
webPageOutput.println(Routines.spaceLines(1));
webPageOutput.println("<CENTER>");
webPageOutput.println("<IMG SRC=\"../Images/FAQ.gif\"" +
" WIDTH='90' HEIGHT='40' ALT='Contact'>");
webPageOutput.println("</CENTER>");
webPageOutput.println(Routines.spaceLines(1));
Routines.tableStart(false,webPageOutput);
Routines.tableHeader("General",0,webPageOutput);
Routines.tableDataStart(true,false,false,true,true,0,0,"scoresrow",webPageOutput);
webPageOutput.println("<B>");
webPageOutput.println("Q: Why are there no Frequently Asked Questions?");
webPageOutput.println("</B>");
webPageOutput.println("<BR>");
webPageOutput.println("A: Because no-one has yet asked any questions, let alone asked them frequently.");
Routines.tableDataEnd(false,true,true,webPageOutput);
Routines.tableEnd(webPageOutput);
webPageOutput.println(Routines.spaceLines(22));
Routines.WriteHTMLTail(request,response,webPageOutput);
}
}