-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
WOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOO
- Loading branch information
1 parent
ff36707
commit c6eb681
Showing
65 changed files
with
377 additions
and
52 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
30 changes: 30 additions & 0 deletions
30
.idea/libraries/JAX_WS_Glassfish___JAX_WS_2_2_RI___Metro_1_X___JWSDP_2_2.xml
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
Manifest-Version: 1.0 | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<application xmlns="https://jakarta.ee/xml/ns/jakartaee" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/application_9.xsd" | ||
version="9"> | ||
<module id="JavaEEHelloWorld-Web"> | ||
<web> | ||
<web-uri>JavaEEHelloWorld.war</web-uri> | ||
<context-root>JavaEEHelloWorldWeb</context-root> | ||
</web> | ||
</module> | ||
|
||
</application> |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
Manifest-Version: 1.0 | ||
Created-By: IntelliJ IDEA | ||
Built-By: 47472 | ||
Build-Jdk: Oracle OpenJDK version 14.0.2 | ||
|
3 changes: 3 additions & 0 deletions
3
out/artifacts/Yatzy_war_exploded/WEB-INF/classes/META-INF/MANIFEST.MF
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
Manifest-Version: 1.0 | ||
Main-Class: jpaMain | ||
|
16 changes: 16 additions & 0 deletions
16
out/artifacts/Yatzy_war_exploded/WEB-INF/classes/META-INF/persistence.xml
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | ||
<persistence xmlns="https://jakarta.ee/xml/ns/persistence" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="https://jakarta.ee/xml/ns/persistence https://jakarta.ee/xml/ns/persistence/persistence_3_0.xsd" | ||
version="3.0"> | ||
<persistence-unit name="personUnit" | ||
transaction-type="JTA"> | ||
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider> | ||
<jta-data-source>myDataSource</jta-data-source> | ||
<class>entity.PersonEntity</class> | ||
<properties> | ||
<property name="eclipselink.weaving" value="false" /> | ||
</properties> | ||
</persistence-unit> | ||
|
||
</persistence> |
10 changes: 10 additions & 0 deletions
10
out/artifacts/Yatzy_war_exploded/WEB-INF/classes/META-INF/resources.xml
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<resources> | ||
<Resource id="myDataSource" name="myDataSource" type="javax.sql.DataSource"> | ||
jdbcDriver = org.postgresql.Driver | ||
jdbcUrl = jdbc:postgresql://ider-database.westeurope.cloudapp.azure.com:5432/h591291 | ||
userName = h591291 | ||
password = pass | ||
</Resource> | ||
</resources> | ||
|
Binary file added
BIN
+890 Bytes
out/artifacts/Yatzy_war_exploded/WEB-INF/classes/autoPlay/autoMain.class
Binary file not shown.
Binary file added
BIN
+4.69 KB
out/artifacts/Yatzy_war_exploded/WEB-INF/classes/autoPlay/autoPlayYatzy.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+949 Bytes
out/artifacts/Yatzy_war_exploded/WEB-INF/classes/backend/Dice.class
Binary file not shown.
Binary file added
BIN
+2.57 KB
out/artifacts/Yatzy_war_exploded/WEB-INF/classes/backend/DiceShaker.class
Binary file not shown.
Binary file added
BIN
+496 Bytes
out/artifacts/Yatzy_war_exploded/WEB-INF/classes/backend/Main.class
Binary file not shown.
Binary file added
BIN
+544 Bytes
out/artifacts/Yatzy_war_exploded/WEB-INF/classes/backend/Player.class
Binary file not shown.
Binary file added
BIN
+4.56 KB
out/artifacts/Yatzy_war_exploded/WEB-INF/classes/backend/RoundUtils.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+2.32 KB
out/artifacts/Yatzy_war_exploded/WEB-INF/classes/entity/PersonEntity.class
Binary file not shown.
Binary file not shown.
Binary file added
BIN
+1.68 KB
out/artifacts/Yatzy_war_exploded/WEB-INF/classes/servlet/PersonServlet.class
Binary file not shown.
31 changes: 31 additions & 0 deletions
31
out/artifacts/Yatzy_war_exploded/WEB-INF/personServlet.jsp
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> | ||
<%@ page language="java" contentType="text/html; charset=utf-8" | ||
pageEncoding="utf-8"%> | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<meta charset="ISO-8859-1"> | ||
<!-- Fra https://purecss.io/ --> | ||
<link rel="stylesheet" | ||
href="https://unpkg.com/purecss@1.0.0/build/pure-min.css"> | ||
<title>SpillerListe</title> | ||
</head> | ||
<body> | ||
<h2>Spillerliste</h2> | ||
<table class="pure-table"> | ||
<tr bgcolor="#cccccc"> | ||
<th align="left">Id</th> | ||
<th align="left">Navn</th> | ||
|
||
</tr> | ||
|
||
<c:forEach items="${spillere}" var="s"> | ||
|
||
|
||
<td>${s.id}</td> | ||
<td>${s.name}</td> | ||
|
||
</c:forEach> | ||
</table> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<web-app xmlns="https://jakarta.ee/xml/ns/jakartaee" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee https://jakarta.ee/xml/ns/jakartaee/web-app_5_0.xsd" | ||
version="5.0"> | ||
<welcome-file-list> | ||
<welcome-file>index.html</welcome-file> | ||
</welcome-file-list> | ||
</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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
|
||
<head> | ||
<meta charset="ISO-8859-1"> | ||
<title> | ||
Yatzy | ||
</title> | ||
</head> | ||
|
||
<body> | ||
<h1> | ||
Yatzy | ||
</h1> | ||
<h2> | ||
<a href="PersonServlet">Se personer</a> | ||
</h2> | ||
|
||
</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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,25 @@ | ||
package dao; | ||
|
||
import entity.PersonEntity; | ||
import jakarta.persistence.EntityManager; | ||
import jakarta.persistence.EntityManagerFactory; | ||
import jakarta.persistence.Persistence; | ||
import jakarta.persistence.TypedQuery; | ||
|
||
import java.beans.JavaBean; | ||
import java.util.List; | ||
import javax.ejb.Stateless; | ||
import javax.persistence.EntityManager; | ||
import javax.persistence.PersistenceContext; | ||
|
||
@Stateless | ||
@JavaBean | ||
public class PersonDAO { | ||
private EntityManagerFactory emf; | ||
|
||
public PersonDAO() { | ||
emf = Persistence.createEntityManagerFactory("PersonUnit"); | ||
} | ||
@PersistenceContext(name = "personUnit") | ||
private EntityManager em; | ||
|
||
public synchronized List<PersonEntity> getAllPersons() { | ||
return em.createQuery("SELECT p FROM PersonEntity p", PersonEntity.class).getResultList(); | ||
} | ||
|
||
public List<PersonEntity> getAllPersons() { | ||
EntityManager em = emf.createEntityManager(); | ||
List<PersonEntity> persons = null; | ||
try { | ||
TypedQuery<PersonEntity> query = em.createQuery("Select p from PersonEntity p", PersonEntity.class); | ||
persons = query.getResultList(); | ||
} finally { | ||
em.close(); | ||
} | ||
return persons; | ||
public void savePerson(PersonEntity person) { | ||
em.persist(person); | ||
} | ||
} | ||
|
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package servlet; | ||
|
||
import dao.PersonDAO; | ||
import entity.PersonEntity; | ||
import jakarta.servlet.*; | ||
import jakarta.servlet.http.*; | ||
import jakarta.servlet.annotation.*; | ||
|
||
import javax.ejb.EJB; | ||
import java.io.IOException; | ||
import java.util.List; | ||
|
||
@WebServlet(name = "PersonServlet", value = "/PersonServlet") | ||
public class PersonServlet extends HttpServlet { | ||
private static final long serialVersionUID = 1L; | ||
|
||
|
||
@EJB | ||
private PersonDAO pDAO; | ||
|
||
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { | ||
|
||
|
||
// Henter alle deltagerene sortert etter navn | ||
List<PersonEntity> spillere = pDAO.getAllPersons(); | ||
|
||
// Setter deltagerene som atributt i requesten, hentes ut i jsp siden... | ||
request.setAttribute("spillere", spillere); | ||
|
||
// G� til deltagerlisten | ||
request.getRequestDispatcher("WEB-INF/personServlet.jsp").forward(request, response); | ||
|
||
|
||
} | ||
|
||
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { | ||
|
||
|
||
// Henter alle deltagerene sortert etter navn | ||
List<PersonEntity> spillere = pDAO.getAllPersons(); | ||
|
||
// Setter deltagerene som atributt i requesten, hentes ut i jsp siden... | ||
request.setAttribute("spillere", spillere); | ||
|
||
// G� til deltagerlisten | ||
request.getRequestDispatcher("WEB-INF/personServlet.jsp").forward(request, response); | ||
} | ||
} |
Oops, something went wrong.