/* Code by George Kichukov for SAS 11/26/2002 * This class is used to modify not available list for Minors */ package admin; import java.io.*; import java.sql.*; import javax.servlet.*; import javax.servlet.http.*; import utilities.*; public class ModifyMajorList extends HttpServlet { private String errorTarget = "../admin/index.jsp"; public void init(ServletConfig config) throws ServletException { super.init(config); } public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { // If it is a get request forward to doPost() doPost(request, response); } public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { //name of the user String name=""; PrintWriter out = response.getWriter(); response.setContentType("text/html"); //first thing that every servlet or jsp should do is check if user is logged in HttpSession session = request.getSession(false); //if not logged in redirect to login if(session == null) { HTMLUtils.printRedirectPage(out, "You must login to the system prior to viewing this page.", errorTarget); return; } //else if logged in take the name from the session else { name=(String)session.getAttribute("user"); //if the name is null if(name == null) { HTMLUtils.printRedirectPage(out, "You must login to the system prior to viewing this page.", errorTarget); return; } } //second output the Admin Header HTMLUtils.printAdminHeader(out); //display welcome message to the user out.println("

Welcome " + name + "

"); //get the parameters String id = request.getParameter("id"); //if this is for specific major or minor String mID = request.getParameter("mID"); String oper = request.getParameter("oper"); String table = request.getParameter("table"); out.println(""); out.println(""); out.println(""); out.println(""); out.println(""); //set up the form out.println("
"); //include required fields needed for processing out.println(""); out.println(""); out.println(""); out.println(""); //if the operation is Modify //prepopulate the form fields if(oper.equals("Modify")) { try { ResultSet rs1=Retriever.executeSQL("select NotAvailableList from " + table + " where MinorID=" + mID); rs1.next(); String req=rs1.getString(1); if(!req.equals("none")) { //parse the requirment string req=RequirementParser.toMajorDisplayString(rs1.getString(1)); } //display textbox for requirement description out.println("
Majors Not Available: "); } catch(SQLException e){out.println("SQLException " + e.getMessage());} } //if the operation is Add //display empty form fields if(oper.equals("Add")) { //display textbox for requirement description out.println("
Majors Not Available: "); } out.println("

"); out.println("   "); out.println(""); out.println("
"); out.println("
"); out.println("
"); //add the submit button and close the form out.println("
"); out.println(""); HTMLUtils.printAdminFooter(out); } }