Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Student-Admin-Redesign/StudentAdminRedesign/src/Dynamic_Class_Search.java
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
112 lines (98 sloc)
3.38 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | |
} | |
} | |
} |