Skip to content

Instantly share code, notes, and snippets.

@ksoumi
ksoumi / SingleDatabaseConnection.java
Created August 1, 2019 04:47
Database Connection MySQL
package io.pivotal.workshop.util;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class SingleDatabaseConnection {
private static Connection connection = null;
@ksoumi
ksoumi / DisplayUsers.java
Created August 1, 2019 04:46
DisplayUser Servlet
package io.pivotal.workshop.controller;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Iterator;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
<display-name>UserApp</display-name>
<servlet>
<description></description>
<display-name>UserController</display-name>
<servlet-name>UserController</servlet-name>
<servlet-class>io.pivotal.workshop.controller.UserController</servlet-class>
</servlet>
<servlet-mapping>
package io.pivotal.workshop.web;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.LinkedList;
import java.util.List;
import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;