// THIS VERSION IS FOR DEMO ONLY, NOT THE ONE I USE. /** ***************************************************************** loginDemo.java SWE 432 Student Information @author Jeff Offutt @version 1.0 (2/21/2004) @version 1.1 (8/24/2007) Upsorn Praphamontripong Update variables to run on Hermes (apps-it821.ite.gmu.edu) Establishes a login using a servlet session. IDs are hardcoded. doGet() prints the login screen. doPost() checks an ID/password and sets the session info. ********************************************************************* INSTALLATION INSTRUCTIONS 1) Modify StudInfoSysDemo.java (Changes marked there) 2) Modify loginDemo.java Change the following global variables: private static String LoginServlet = "http://ise.gmu.edu:8080/offutt/servlet/StudInfoDemo.loginDemo"; // ise private static String JSPLoc = "http://ise.gmu.edu:8080/offutt/jsp/"; // ise public static String classWebSiteURL = "http://www.ise.gmu.edu/~offutt/classes/Demo/"; public static String FileName = "/home/faculty/ofut/public_html/DATA/Demo-info-S06.xml"; // ise Also change the hard-coded passwords (feel free to laugh) in doPost(): if ((demoUserID.equals ("xxx") && demoPassWord.equals ("xxx")) || (demoUserID.equals ("xxx") && demoPassWord.equals ("xxx")) ) 2) Compille .java classes 3) Move .class files to ~/j2ee/servlets/StudInfoDemo 4) Copy .jsp files to ~/j2ee/jsp 5) URL: http://ise.gmu.edu:8080/offutt/servlet/StudInfoDemo.StudInfoSysDemo ********************************************************************* */ package StudInfoDemo; // Import Servlet Libraries import javax.servlet.*; import javax.servlet.http.*; // Import Java Libraries import java.io.*; import java.util.*; import java.lang.*; // login class // //*********************************************************************** public class loginDemo extends HttpServlet { private static String LoginServlet = "http://apps-inst.ite.gmu.edu:8080/swe432/servlet/StudInfoDemo.loginDemo"; // Hermes private static String JSPLoc = "http://apps-inst.ite.gmu.edu:8080/swe432/jsp/StudInfoDemo/"; public static String classWebSiteURL = "http://www.ise.gmu.edu/~offutt/classes/432/"; public static String FileName = "/apps/tomcat/swe432/WEB-INF/data/Demo-info-F07.xml"; // Form parameters. private static String demoUserID; private static String demoPassWord; // doPost() tells doGet() when the login is invalid. private static boolean invalidID = false; private static String fromJSP; /** ***************************************************** * Overrides HttpServlet's doGet(). * prints the login form. ********************************************************* */ public void doGet (HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException { fromJSP = req.getParameter ("jspFrom"); res.setContentType ("TEXT/HTML"); PrintWriter out = res.getWriter (); out.println (""); out.println (""); out.println ("
"); out.println ("