draft(DevWeb): Rooting by servlet

This commit is contained in:
Lucàs
2024-03-20 17:20:27 +01:00
parent a8496d6124
commit 3cfece25e3
14 changed files with 110 additions and 30 deletions
@@ -0,0 +1,16 @@
<%--
Created by IntelliJ IDEA.
User: lucas
Date: 20/03/2024
Time: 16:47
To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
<title>Title</title>
</head>
<body>
</body>
</html>
@@ -15,7 +15,10 @@
<div class="flex-column login-gap">
<div>
<h1>Login</h1>
<form id="login-form" data-login-endpoint="api/login" action="dashboard.jsp" method="POST">
<form id="login-form"
data-login-endpoint="${pageContext.request.contextPath}/login"
action="${pageContext.request.contextPath}/login"
method="POST">
<label id="username-label" for="username">Username:</label>
<input type="text" id="username" name="username" required>
@@ -28,6 +31,7 @@
</form>
</div>
<div>
<p><a href="forgottenPassword.jsp">Forgotten password?</a></p>
<hr>
<p>Don't have an account? <a href="register.jsp">Register</a></p>
</div>
@@ -34,7 +34,7 @@
<th>Game won</th>
<th>Invite</th>
</tr>
<%-- Récuperer les joueurs connecter et les lister sous forme de tableau--%>
<%-- Récuperer les joueurs connecter et les lister sous forme de tableau--%>
</table>
</div>
</section>
@@ -1,25 +0,0 @@
<%@ page import="static jdk.internal.net.http.common.Utils.dump" %>
<%@ page import="uppa.project.pojo.User" %>
<%@ page import="uppa.project.dao.jpa.Game_JPA_DAO_Factory" %>
<%@ page import="uppa.project.dao.DAO" %>
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%
User user = (User) (request.getAttribute("session"));
%>
<!DOCTYPE html>
<html>
<head>
<title>JSP - Hello World</title>
</head>
<body>
<% if (user == null) { %>
<%-- Pas de user connecté -> On envoi sur la page de connection --%>
<jsp:include page="login.jsp"></jsp:include>
<% } else {
session.setAttribute("sessionUser", session);
%>
<jsp:include page="dashboard.jsp"></jsp:include>
<% } %>
</body>
</html>