Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Ryan's basic stuff
Contains some starter code for dynamic class search html page and post
requests to pull from database
  • Loading branch information
Ryan Blau authored and Ryan Blau committed Nov 7, 2016
1 parent 2c74c57 commit 4e64de8
Show file tree
Hide file tree
Showing 15 changed files with 341 additions and 0 deletions.
17 changes: 17 additions & 0 deletions StudentAdminRedesign/.classpath
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/jre1.8.0_102">
<attributes>
<attribute name="owner.project.facets" value="java"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jst.server.core.container/org.eclipse.jst.server.tomcat.runtimeTarget/Apache Tomcat v7.0">
<attributes>
<attribute name="owner.project.facets" value="jst.web"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
<classpathentry kind="output" path="build/classes"/>
</classpath>
36 changes: 36 additions & 0 deletions StudentAdminRedesign/.project
@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>StudentAdminRedesign</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.wst.jsdt.core.javascriptValidator</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.common.project.facet.core.builder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.wst.jsdt.core.jsNature</nature>
</natures>
</projectDescription>
12 changes: 12 additions & 0 deletions StudentAdminRedesign/.settings/.jsdtscope
@@ -0,0 +1,12 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="WebContent"/>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.WebProject">
<attributes>
<attribute name="hide" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="con" path="org.eclipse.wst.jsdt.launching.baseBrowserLibrary"/>
<classpathentry kind="output" path=""/>
</classpath>
7 changes: 7 additions & 0 deletions StudentAdminRedesign/.settings/org.eclipse.jdt.core.prefs
@@ -0,0 +1,7 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.7
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?><project-modules id="moduleCoreId" project-version="1.5.0">
<wb-module deploy-name="StudentAdminRedesign">
<wb-resource deploy-path="/" source-path="/WebContent" tag="defaultRootSource"/>
<wb-resource deploy-path="/WEB-INF/classes" source-path="/src"/>
<property name="context-root" value="StudentAdminRedesign"/>
<property name="java-output-path" value="/StudentAdminRedesign/build/classes"/>
</wb-module>
</project-modules>
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<faceted-project>
<runtime name="Apache Tomcat v7.0"/>
<fixed facet="jst.web"/>
<fixed facet="java"/>
<fixed facet="wst.jsdt.web"/>
<installed facet="java" version="1.7"/>
<installed facet="jst.web" version="3.0"/>
<installed facet="wst.jsdt.web" version="1.0"/>
</faceted-project>
@@ -0,0 +1 @@
org.eclipse.wst.jsdt.launching.baseBrowserLibrary
@@ -0,0 +1 @@
Window
82 changes: 82 additions & 0 deletions StudentAdminRedesign/WebContent/Dynamic_Class_Search_test.html
@@ -0,0 +1,82 @@
<!DOCTYPE html>
<html>
<body>
<style>
h1{
background-color:#000E2F;
}
p.menu_bar{border-style:solid;
background-color:#7C878E}
div{
background-color:#7C878E
}
</style>
<h1>
<p class="menu_bar" align="right"><a href="http://google.com"><font size=.5>Home</font></a>
<a href="http://google.com"><font size=.5>Instructor/Advisor Help</font></a>
<a href="http://google.com"><font size=.5>Student Help</font></a>
<a href="http://google.com"><font size=.5>Admin Help</font></a>
<a href="http://google.com"><font size=.5>Add to Favorites</font></a>
<a href="http://google.com"><font size=.5>Sign Out</font></a></p>
<br><br>
<b><font color="white">UCONN Dynamic Class Search</font></b>
<hr></hr>
<br><font size=3 color="white">University of Connecticut</font><br><br>
</h1>
<div>
<form action="Dynamic_Class_Search" method="post">
<select name="Department">
<option value="Default">Select Department</option>
<option value="Math">Math</option>
<option value="CHEM">CHEM</option>
<option value="CSE">CSE</option>
<option value="ohlawd">Oh god there are a lot these to type</option>
</select>*
<select name="Term">
<option value="Default">Select Term</option>
<option value="Spring2017" name="Spring2017">Spring 2017</option>
<option value="Fall2017">Fall 2017</option>
<option value="Spring2018">Spring 2018</option>
</select>*
<select name="Courselvl">
<option value="Default">Select Class Database</option>
<option value="RatcliffeHicks">Ratcliffe Hicks: 0-999</option>
<option value="Undergrad">Undergraduate: 1000-4999</option>
<option value="Graduate_PharmD">Graduate/PharmD: 5000-6999</option>
<option value="Law">Law 7000-7999</option>
<option value="NonCredit">Non-credit</option>
</select>*
<select name=Campus>
<option value="Default">Select Campus</option>
<option value="Storrs">Storrs</option>
<option value="Stamford">Stamford</option>
<option value="Hartford">Hartford</option>
<option value="AveryPt">Avery Pt</option>
<option value="Torrington">Torrington</option>
<option value="Waterbury">Waterbury</option>
<option value="HealthCtr">Health Ctr</option>
<option value="LawSchool">Law Schools</option>
<option value="OffCampus">Off-Campus</option>
<option value="Online">Online Courses</option>
</select>*
<br><br>
<input type="checkbox" name="Open?" value="Open"> Open Only
<input type="checkbox" name="Honors?" value="Honors"> Honors Only
<input type="checkbox" name="Q?" value="Q"> Q Only
<input type="checkbox" name="W?" value="W"> W Only
<input type="checkbox" name="Recommended?" value="Recommended"> Recommended Only <br><br>
Course name or number: <input type="text" name="Course" placeholder="Course Name/Number">
<br>
Required fields are marked with an "*".
<br>
<input type="Submit" value="Search">
</form>
</div>
<div>
<form action="http://google.com">
<p align="right"><input type="submit" value="Return to Main Menu" /></p>
</form>
</div>

</body>
</html>
3 changes: 3 additions & 0 deletions StudentAdminRedesign/WebContent/META-INF/MANIFEST.MF
@@ -0,0 +1,3 @@
Manifest-Version: 1.0
Class-Path:

23 changes: 23 additions & 0 deletions StudentAdminRedesign/WebContent/META-INF/context.xml
@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<Context>

<Resource name="jdbc/SA_Development"

auth="Container"

type="javax.sql.DataSource"

username="root"

password="q_v_the_db_man"

driverClassName="com.mysql.jdbc.Driver"

url="jdbc:mysql:/localhost:3306/StudentAdminRedesign"

maxActive="15"

maxIdle="3"/>

</Context>

12 changes: 12 additions & 0 deletions StudentAdminRedesign/WebContent/WEB-INF/response.jsp
@@ -0,0 +1,12 @@
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Insert title here</title>
</head>
<body>

</body>
</html>
17 changes: 17 additions & 0 deletions StudentAdminRedesign/WebContent/WEB-INF/web.xml
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<web-app>

<resource-ref>

<description>Student Admin Database for classes and student information</description>

<res-ref-name>jdbc/StudentAdminDB</res-ref-name>

<res-type>javax.sql.DataSource</res-type>

<res-auth>Container</res-auth>

</resource-ref>

</web-app>

Binary file not shown.
112 changes: 112 additions & 0 deletions StudentAdminRedesign/src/Dynamic_Class_Search.java
@@ -0,0 +1,112 @@


import java.io.IOException;

import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.lang.Object;
import java.io.PrintWriter;
import java.sql.*;
import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.sql.DataSource;

/**
* Servlet implementation class Dynamic_Class_Search
*/
@WebServlet("/Dynamic_Class_Search_tester")
public class Dynamic_Class_Search extends HttpServlet {
private static final long serialVersionUID = 1L;

/**
* @see HttpServlet#HttpServlet()
*/
public Dynamic_Class_Search() {
super();
// TODO Auto-generated constructor stub
}

/**
* @see Servlet#init(ServletConfig)
*/
// public void init(ServletConfig config) throws ServletException {
// // TODO Auto-generated method stub
// System.out.println("Hello");
// }
//
// /**
// * @see HttpServlet#service(HttpServletRequest request, HttpServletResponse response)
// */
// protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// // TODO Auto-generated method stub
// System.out.println("Hello2");
//
// }
//
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String Term = request.getParameter("Term");
String Session = request.getParameter("Session");
String Campus = request.getParameter("Campus");
String Department = request.getParameter("Department");
String Course = request.getParameter("Course");
String Courselvl = request.getParameter("Courselvl");
String Open = request.getParameter("Open?");
String Honors = request.getParameter("Honors?");
String W = request.getParameter("W?");
String Q = request.getParameter("Q?");
String Recommended = request.getParameter("Recommended?");
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String Term = request.getParameter("Term");
String Session = request.getParameter("Session");
String Campus = request.getParameter("Campus");
String Department = request.getParameter("Department");
String Course = request.getParameter("Course");
String Courselvl = request.getParameter("Courselvl");
String Open = request.getParameter("Open?");
String Honors = request.getParameter("Honors?");
String W = request.getParameter("W?");
String Q = request.getParameter("Q?");
String Recommended = request.getParameter("Recommended?");
Context initCtx = null;
try {
initCtx = new InitialContext();
} catch (NamingException e2) {
// TODO Auto-generated catch block
e2.printStackTrace();
}

Context envCtx = null;
try {
envCtx = (Context) initCtx.lookup("java:comp/env");
} catch (NamingException e1) {
// TODO Auto-generated catch block
e1.printStackTrace();
}

try {
DataSource ds = (DataSource)

envCtx.lookup("jdbc/[YourResourceName]");
} catch (NamingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}




}

}

0 comments on commit 4e64de8

Please sign in to comment.