-
-
Save Fernando-Dev/3478df7d765f41657a3a003070188a80 to your computer and use it in GitHub Desktop.
Finished Simple JDBC(mySql) jsp servlet CRUD
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
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | |
<modelVersion>4.0.0</modelVersion> | |
<groupId>lalala</groupId> | |
<artifactId>lalala</artifactId> | |
<packaging>war</packaging> | |
<version>1.0-SNAPSHOT</version> | |
<name>lalala Maven Webapp</name> | |
<url>http://maven.apache.org</url> | |
<dependencies> | |
<dependency> | |
<groupId>junit</groupId> | |
<artifactId>junit</artifactId> | |
<version>3.8.1</version> | |
<scope>test</scope> | |
</dependency> | |
<!-- https://mvnrepository.com/artifact/javax.servlet/javax.servlet-api --> | |
<dependency> | |
<groupId>javax.servlet</groupId> | |
<artifactId>javax.servlet-api</artifactId> | |
<version>3.1.0</version> | |
</dependency> | |
<!-- https://mvnrepository.com/artifact/jstl/jstl --> | |
<dependency> | |
<groupId>jstl</groupId> | |
<artifactId>jstl</artifactId> | |
<version>1.2</version> | |
</dependency> | |
<dependency> | |
<groupId>mysql</groupId> | |
<artifactId>mysql-connector-java</artifactId> | |
<version>5.1.23</version> | |
</dependency> | |
</dependencies> | |
<build> | |
<finalName>lalala</finalName> | |
</build> | |
</project> |
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
package connector; | |
import java.sql.Connection; | |
import java.sql.DriverManager; | |
import java.sql.SQLException; | |
/** | |
* Created by user on 30.10.2016. | |
*/ | |
public abstract class DbConnector { | |
public static Connection getDbConnection() { | |
Connection connection = null; | |
String url = "jdbc:mysql://localhost:3306/lalala"; | |
String pass = "root"; | |
String user = "root"; | |
try { | |
Class.forName("com.mysql.jdbc.Driver"); | |
connection = DriverManager.getConnection(url, user, pass); | |
System.out.println(connection); | |
} catch (SQLException e) { | |
e.printStackTrace(); | |
} catch (ClassNotFoundException e) { | |
e.printStackTrace(); | |
} | |
return connection; | |
} | |
} |
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
package controllers; | |
import dao.ClientDao; | |
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.io.IOException; | |
/** | |
* Created by user on 18.10.2016. | |
*/ | |
//@WebServlet(name = "ControllerAdmin") | |
public class ControllerAdmin extends HttpServlet { | |
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { | |
doGet(request, response); | |
} | |
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { | |
request.setAttribute("clients", ClientDao.getClients()); | |
request.getServletContext().getRequestDispatcher("/admin.jsp").forward(request, response); | |
} | |
} |
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
package controllers; | |
import dao.ClientDao; | |
import models.Client; | |
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.io.IOException; | |
/** | |
* Created by user on 01.11.2016. | |
*/ | |
//@WebServlet(name = "ServletDell") | |
public class ServletDell extends HttpServlet { | |
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { | |
// UNUSED | |
} | |
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { | |
int id = Integer.parseInt(request.getParameter("id")); | |
Client client = ClientDao.getClient(id); | |
ClientDao.dellClient(client); | |
request.getRequestDispatcher("/admin").forward(request,response); | |
} | |
} |
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
package controllers; | |
import dao.ClientDao; | |
import models.Client; | |
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.io.IOException; | |
import java.util.ArrayList; | |
/** | |
* Created by user on 29.10.2016. | |
*/ | |
//@WebServlet(name = "ServletLogin") | |
public class ServletLogin extends HttpServlet { | |
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { | |
String login = request.getParameter("login"); | |
String pass = request.getParameter("pass"); | |
ArrayList<Client> clients = ClientDao.getClients(); | |
if (login.equalsIgnoreCase("admin") && pass.equalsIgnoreCase("admin")) { | |
request.getRequestDispatcher("/admin").forward(request,response); | |
} else { | |
for (Client client : clients) { | |
if (client.getClientLogin().equalsIgnoreCase(login) && client.getClientPass().equalsIgnoreCase(pass)) { | |
request.setAttribute("clients", clients); | |
request.getRequestDispatcher("/result.jsp").forward(request, response); | |
} else if (client.getClientLogin().equalsIgnoreCase(login)) { | |
request.setAttribute("mess", " password entered incorrectly"); | |
request.getRequestDispatcher("/index.jsp").forward(request, response); | |
} else { | |
request.setAttribute("mess", " the given user name is not found please register "); | |
request.getRequestDispatcher("/register.jsp").forward(request, response); | |
} | |
} | |
} | |
} | |
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { | |
// UNUSED | |
} | |
} |
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
package controllers; | |
import dao.ClientDao; | |
import models.Client; | |
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.io.IOException; | |
import java.util.ArrayList; | |
/** | |
* Created by user on 31.10.2016. | |
*/ | |
//@WebServlet(name = "ServletLook") | |
public class ServletLook extends HttpServlet { | |
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { | |
// UNUSED | |
} | |
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { | |
ArrayList<Client> clients = ClientDao.getClients(); | |
request.getServletContext().setAttribute("clients", clients); | |
request.getRequestDispatcher("/result.jsp").forward(request, response); | |
} | |
} |
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
package controllers; | |
import dao.ClientDao; | |
import models.Client; | |
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.io.IOException; | |
import java.util.ArrayList; | |
/** | |
* Created by user on 29.10.2016. | |
*/ | |
//@WebServlet(name = "ServletRegister") | |
public class ServletRegister extends HttpServlet { | |
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { | |
String clientPass2 = request.getParameter("pass2"); | |
ArrayList<Client> clients; | |
Client client = getClient(request); | |
boolean checkLoginPass = checkClient(client, clientPass2); | |
if (checkLoginPass) { | |
ClientDao.registerClient(client); | |
clients = ClientDao.getClients(); | |
request.setAttribute("clients", clients); | |
request.getServletContext().getRequestDispatcher("/result.jsp").forward(request, response); | |
} else { | |
request.setAttribute("mess", " you entered passwords are not identical "); | |
request.getServletContext().getRequestDispatcher("/register.jsp").forward(request, response); | |
} | |
} | |
private Client getClient(HttpServletRequest request) { | |
String clientLogin = request.getParameter("login"); | |
String clientEmail = request.getParameter("email"); | |
String clientPass = request.getParameter("pass"); | |
Client client = new Client(); | |
client.setClientLogin(clientLogin); | |
client.setClientEmail(clientEmail); | |
client.setClientPass(clientPass); | |
return client; | |
} | |
private boolean checkClient(Client client, String clientPass2) { | |
if (client.getClientPass().equalsIgnoreCase(clientPass2)) { | |
return true; | |
} else { | |
return false; | |
} | |
} | |
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { | |
// UNUSED | |
} | |
} |
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
package controllers; | |
import dao.ClientDao; | |
import models.Client; | |
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.io.IOException; | |
/** | |
* Created by user on 01.11.2016. | |
*/ | |
//@WebServlet(name = "ServletUpdate") | |
public class ServletUpdate extends HttpServlet { | |
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { | |
System.out.println("doPost1"); | |
int id = Integer.parseInt(request.getParameter("id")); | |
String clientLogin = request.getParameter("login"); | |
String clientEmail = request.getParameter("email"); | |
String clientPass = request.getParameter("pass"); | |
System.out.println(clientLogin + clientEmail + clientPass); | |
Client client = new Client(); | |
System.out.println(client.toString()); | |
client.setClientId(id); | |
client.setClientLogin(clientLogin); | |
client.setClientEmail(clientEmail); | |
client.setClientPass(clientPass); | |
ClientDao.updateClient(client); | |
System.out.println(ClientDao.getClient(client.getClientId())); | |
request.getRequestDispatcher("/admin").forward(request, response); | |
System.out.println("doPost2"); | |
} | |
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { | |
Client client = ClientDao.getClient(Integer.parseInt(request.getParameter("id"))); | |
request.getServletContext().setAttribute("client", client); | |
request.getRequestDispatcher("/update.jsp").forward(request, response); | |
System.out.println("doGet"); | |
} | |
} |
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
package dao; | |
import connector.DbConnector; | |
import models.Client; | |
import java.sql.*; | |
import java.util.ArrayList; | |
/** | |
* Created by user on 29.10.2016. | |
*/ | |
public abstract class ClientDao { | |
public static void registerClient(Client client) { | |
String sql = "INSERT INTO `lalala`.`client` (`clientlogin`, `clientemail`, `clientpass`) VALUES ('" + | |
client.getClientLogin() + "', '" + | |
client.getClientEmail() + "', '" + | |
client.getClientPass() + "');"; | |
Connection connection = DbConnector.getDbConnection(); | |
Statement statement; | |
try { | |
statement = connection.createStatement(); | |
statement.execute(sql); | |
} catch (SQLException e) { | |
e.printStackTrace(); | |
} | |
} | |
public static ArrayList<Client> getClients() { | |
ArrayList<Client> clients = new ArrayList<Client>(); | |
String sql = "SELECT * FROM lalala.client;"; | |
Connection connection = DbConnector.getDbConnection(); | |
Statement statement; | |
ResultSet resultSet; | |
Client client; | |
try { | |
statement = connection.createStatement(); | |
resultSet = statement.executeQuery(sql); | |
while (resultSet.next()) { | |
client = new Client(); | |
client.setClientId(resultSet.getInt("idclient")); | |
client.setClientLogin(resultSet.getString("clientlogin")); | |
client.setClientPass(resultSet.getString("clientpass")); | |
client.setClientEmail(resultSet.getString("clientemail")); | |
clients.add(client); | |
} | |
} catch (SQLException e) { | |
e.printStackTrace(); | |
} | |
return clients; | |
} | |
public static Client getClient(int idClient) { | |
String sql = "SELECT * FROM lalala.client WHERE idclient = " + | |
idClient + ";"; | |
Connection connection = DbConnector.getDbConnection(); | |
Statement statement; | |
ResultSet resultSet; | |
Client client = new Client(); | |
try { | |
statement = connection.createStatement(); | |
resultSet = statement.executeQuery(sql); | |
while (resultSet.next()) { | |
client.setClientId(resultSet.getInt("idclient")); | |
client.setClientLogin(resultSet.getString("clientlogin")); | |
client.setClientPass(resultSet.getString("clientpass")); | |
client.setClientEmail(resultSet.getString("clientemail")); | |
} | |
} catch (SQLException e) { | |
e.printStackTrace(); | |
} | |
return client; | |
} | |
public static void updateClient(Client client) { | |
String sql = " UPDATE lalala.client set clientlogin = ?, clientpass = ?, clientemail = ? WHERE idclient =" + | |
client.getClientId() + ""; | |
Connection connection = DbConnector.getDbConnection(); | |
PreparedStatement statement; | |
try { | |
statement = connection.prepareStatement(sql); | |
statement.setString(1, client.getClientLogin()); | |
statement.setString(2, client.getClientPass()); | |
statement.setString(3, client.getClientEmail()); | |
statement.executeUpdate(); | |
} catch (SQLException e) { | |
e.printStackTrace(); | |
} | |
} | |
public static void dellClient(Client client) { | |
String sql = "DELETE FROM lalala.client WHERE idclient = ?;"; | |
Connection connection = DbConnector.getDbConnection(); | |
PreparedStatement statement; | |
try { | |
statement = connection.prepareStatement(sql); | |
statement.setInt(1, client.getClientId()); | |
statement.executeUpdate(); | |
} catch (SQLException e) { | |
e.printStackTrace(); | |
} | |
} | |
} |
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
package models; | |
/** | |
* Created by user on 29.10.2016. | |
*/ | |
public class Client { | |
int clientId; | |
String clientLogin; | |
String clientEmail; | |
String clientPass; | |
@Override | |
public String toString() { | |
return "Client{" + | |
"clientId=" + clientId + | |
", clientLogin='" + clientLogin + '\'' + | |
", clientEmail='" + clientEmail + '\'' + | |
", clientPass='" + clientPass + '\'' + | |
'}'; | |
} | |
public Client() { | |
} | |
public int getClientId() { | |
return clientId; | |
} | |
public void setClientId(int clientId) { | |
this.clientId = clientId; | |
} | |
public String getClientLogin() { | |
return clientLogin; | |
} | |
public void setClientLogin(String clientLogin) { | |
this.clientLogin = clientLogin; | |
} | |
public String getClientEmail() { | |
return clientEmail; | |
} | |
public void setClientEmail(String clientEmail) { | |
this.clientEmail = clientEmail; | |
} | |
public String getClientPass() { | |
return clientPass; | |
} | |
public void setClientPass(String clientPass) { | |
this.clientPass = clientPass; | |
} | |
} |
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
<%-- | |
Created by IntelliJ IDEA. | |
User: user | |
Date: 31.10.2016 | |
Time: 20:26 | |
To change this template use File | Settings | File Templates. | |
--%> | |
<%@ page contentType="text/html;charset=UTF-8" language="java" %> | |
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> | |
<html> | |
<head> | |
<title>Administration</title> | |
</head> | |
<body> | |
<table border="2"> | |
<tr> | |
<td>Id</td> | |
<td>Login</td> | |
<td>email</td> | |
<td>Dell</td> | |
<td>Update</td> | |
</tr> | |
<c:forEach var="client" items="${clients}"> | |
<tr> | |
<td>${client.getClientId()}</td> | |
<td>${client.getClientLogin()}</td> | |
<td>${client.getClientEmail()}</td> | |
<td><a href="/dell?id=${client.getClientId()}">Dell</a></td> | |
<td><a href="/update?id=${client.getClientId()}">Update</a></td> | |
</tr> | |
</c:forEach> | |
</table> | |
<a href="/admin">To main</a> | |
</body> | |
</html> |
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
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> | |
<%@ page contentType="text/html; charset=UTF-8" language="java" pageEncoding="UTF-8" %> | |
<%--<jsp:u seBean id="name" class="controllers.ControllerAdmin" scope="request"/>--%> | |
<%--<%@ page isELIgnored="false" %>--%> | |
<html> | |
<body> | |
<h2>Hello! my dear friend.</h2> | |
<form method="post" action="/login"> | |
<table border="2"> | |
<tr>Please login here :</tr> | |
<tr><c:if test="${mess != null}">${mess}</c:if><c:if | |
test="${mess==null}"> check language on your keyboard </c:if></tr> | |
<tr> | |
<td>Login...</td> | |
<td><input type="text" name="login"/></td> | |
</tr> | |
<tr> | |
<td>Password...</td> | |
<td><input type="password" name="pass"/></td> | |
</tr> | |
<tr> | |
<td> | |
<input type="reset" value="Reset"/> | |
<input type="submit" value="Login"/> | |
</td> | |
</tr> | |
</table> | |
</form> | |
<p> | |
<a href="/register.jsp">to Register form ...</a> | |
</p> | |
<p> | |
<a href="/look">look as guest...</a> | |
</p> | |
<p> | |
<a href="/author.jsp">developed by: Ψ Χ</a> | |
</p> | |
</body> | |
</html> |
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
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> | |
<%-- | |
Created by IntelliJ IDEA. | |
User: user | |
Date: 29.10.2016 | |
Time: 20:00 | |
To change this template use File | Settings | File Templates. | |
--%> | |
<%@ page contentType="text/html;charset=UTF-8" language="java" %> | |
<html> | |
<head> | |
<title>Register Page</title> | |
</head> | |
<body> | |
<form method="post" action="/register" > | |
<table border="2"> | |
<tr>Please register here :</tr> | |
<tr><c:if test="${mess != null}">${mess}</c:if><c:if test="${mess == null}">carefully enter values</c:if> </tr> | |
<tr> | |
<td>Login...</td> | |
<td><input type="text" name="login"/></td> | |
</tr> | |
<tr> | |
<td>Enter password first time...</td> | |
<td><input type="password" name="pass"/></td> | |
</tr> | |
<tr> | |
<td>one more time enter password...</td> | |
<td><input type="password" name="pass2"/></td> | |
</tr> | |
<tr> | |
<td>email...</td> | |
<td><input type="email" name="email"/></td> | |
</tr> | |
<tr> | |
<td> | |
<input type="reset" value="Reset"/> | |
</td> | |
<td> | |
<input type="submit" value="Register"/> | |
</td> | |
</tr> | |
</table> | |
</form> | |
<a href="/">To main</a> | |
</body> | |
</html> |
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
<%-- | |
Created by IntelliJ IDEA. | |
User: user | |
Date: 17.10.2016 | |
Time: 11:23 | |
To change this template use File | Settings | File Templates. | |
--%> | |
<%@ page contentType="text/html;charset=UTF-8" language="java" %> | |
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> | |
<html> | |
<head> | |
<title>Result</title> | |
</head> | |
<body> | |
<h2>this is result servlet</h2> | |
<table border="2"> | |
<tr> | |
<td>Id</td> | |
<td>Login</td> | |
<td>email</td> | |
</tr> | |
<c:forEach var="client" items="${clients}"> | |
<tr> | |
<td>${client.getClientId()}</td> | |
<td>${client.getClientLogin()}</td> | |
<td>${client.getClientEmail()}</td> | |
</tr> | |
</c:forEach> | |
</table> | |
<a href="/">To main</a> | |
</body> | |
</html> |
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
<%-- | |
Created by IntelliJ IDEA. | |
User: user | |
Date: 01.11.2016 | |
Time: 19:09 | |
To change this template use File | Settings | File Templates. | |
--%> | |
<%@ page contentType="text/html;charset=UTF-8" language="java" %> | |
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> | |
<html> | |
<head> | |
<title>Update Page</title> | |
</head> | |
<body> | |
<form action="/update" method="post"> | |
<table border="2"> | |
<tr> | |
<td>Id</td> | |
<td>Login</td> | |
<td>email</td> | |
<td>Password</td> | |
</tr> | |
<tr> | |
<td><input type="text" name="id" value="${client.getClientId()}"/></td> | |
<td><input type="text" name="login" value="${client.getClientLogin()}"/></td> | |
<td><input type="text" name="email" value="${client.getClientEmail()}"/></td> | |
<td><input type="text" name="pass" value="${client.getClientPass()}"/></td> | |
</tr> | |
<br><input type="submit" value="UPDATE"></br> | |
</table> | |
</form> | |
<a href="/">To main</a> | |
</body> | |
</html> |
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
<?xml version="1.0" encoding="UTF-8"?> | |
<web-app id="WebApp_ID" version="2.4" | |
xmlns="http://java.sun.com/xml/ns/j2ee" | |
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | |
xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee | |
http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd"> | |
<servlet> | |
<servlet-name>controllerAdmin</servlet-name> | |
<servlet-class>controllers.ControllerAdmin</servlet-class> | |
</servlet> | |
<servlet> | |
<servlet-name>ServletLogin</servlet-name> | |
<servlet-class>controllers.ServletLogin</servlet-class> | |
</servlet> | |
<servlet> | |
<servlet-name>ServletRegister</servlet-name> | |
<servlet-class>controllers.ServletRegister</servlet-class> | |
</servlet> | |
<servlet-mapping> | |
<servlet-name>ServletRegister</servlet-name> | |
<url-pattern>/register</url-pattern> | |
</servlet-mapping> | |
<servlet-mapping> | |
<servlet-name>controllerAdmin</servlet-name> | |
<url-pattern>/admin</url-pattern> | |
</servlet-mapping> | |
<servlet-mapping> | |
<servlet-name>ServletLogin</servlet-name> | |
<url-pattern>/login</url-pattern> | |
</servlet-mapping> | |
<servlet> | |
<servlet-name>ServletLook</servlet-name> | |
<servlet-class>controllers.ServletLook</servlet-class> | |
</servlet> | |
<servlet-mapping> | |
<servlet-name>ServletLook</servlet-name> | |
<url-pattern>/look</url-pattern> | |
</servlet-mapping> | |
<servlet> | |
<servlet-name>ServletDell</servlet-name> | |
<servlet-class>controllers.ServletDell</servlet-class> | |
</servlet> | |
<servlet-mapping> | |
<servlet-name>ServletDell</servlet-name> | |
<url-pattern>/dell</url-pattern> | |
</servlet-mapping> | |
<servlet> | |
<servlet-name>ServletUpdate</servlet-name> | |
<servlet-class>controllers.ServletUpdate</servlet-class> | |
</servlet> | |
<servlet-mapping> | |
<servlet-name>ServletUpdate</servlet-name> | |
<url-pattern>/update</url-pattern> | |
</servlet-mapping> | |
</web-app> |
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 dao.ClientDao; | |
import models.Client; | |
import java.util.ArrayList; | |
/** | |
* Created by user on 31.10.2016. | |
*/ | |
public class mainTest { | |
// public static void main(String[] args) { | |
// ArrayList <Client> clients = ClientDao.getClients(); | |
// System.out.println(clients.toString()); | |
// } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment