diff options
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/pokemon/Database.java | 30 | ||||
-rw-r--r-- | src/main/webapp/META-INF/MANIFEST.MF | 3 | ||||
-rw-r--r-- | src/main/webapp/WEB-INF/web.xml | 12 | ||||
-rw-r--r-- | src/main/webapp/index.jsp | 21 |
4 files changed, 66 insertions, 0 deletions
diff --git a/src/main/java/pokemon/Database.java b/src/main/java/pokemon/Database.java new file mode 100644 index 0000000..3491ab4 --- /dev/null +++ b/src/main/java/pokemon/Database.java @@ -0,0 +1,30 @@ +package pokemon; +import java.sql.Connection; +import java.sql.DriverManager; +import java.sql.SQLException; + +public class Database { + private Connection conn; + static Database instance=null; + + private Database() { + String connString="jdbc:mysql://localhost:3306/pokemon?user=root&password="; + try { + Class.forName("com.mysql.cj.jdbc.Driver"); + conn=DriverManager.getConnection(connString); + } catch (Exception e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + public static Database getInstance() { + if(instance==null) + instance=new Database(); + return instance; + } + public String getUsername() { + return "test123"; + } + +} diff --git a/src/main/webapp/META-INF/MANIFEST.MF b/src/main/webapp/META-INF/MANIFEST.MF new file mode 100644 index 0000000..254272e --- /dev/null +++ b/src/main/webapp/META-INF/MANIFEST.MF @@ -0,0 +1,3 @@ +Manifest-Version: 1.0 +Class-Path: + diff --git a/src/main/webapp/WEB-INF/web.xml b/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000..08c58a0 --- /dev/null +++ b/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,12 @@ +<?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_3_0.xsd" id="WebApp_ID" version="3.0"> + <display-name>ImiPokemon</display-name> + <welcome-file-list> + <welcome-file>index.html</welcome-file> + <welcome-file>index.jsp</welcome-file> + <welcome-file>index.htm</welcome-file> + <welcome-file>default.html</welcome-file> + <welcome-file>default.jsp</welcome-file> + <welcome-file>default.htm</welcome-file> + </welcome-file-list> +</web-app>
\ No newline at end of file diff --git a/src/main/webapp/index.jsp b/src/main/webapp/index.jsp new file mode 100644 index 0000000..9e758a4 --- /dev/null +++ b/src/main/webapp/index.jsp @@ -0,0 +1,21 @@ +<%@ page language="java" contentType="text/html; charset=ISO-8859-1" + pageEncoding="ISO-8859-1"%> + <%@page import="pokemon.Database"%> +<!DOCTYPE html> +<% %> +<html> +<head> +<meta charset="ISO-8859-1"> +<title>Insert title here</title> +</head> +<body> +<% + +Database d=Database.getInstance(); + +out.print(d.getUsername()); + +%> + +</body> +</html>
\ No newline at end of file |