1

added index.html

This commit is contained in:
AndiBuls
2020-03-05 14:18:17 +01:00
parent babac2279d
commit 0a751c58b6
5 changed files with 31 additions and 2 deletions

View File

@ -1,12 +1,16 @@
package mops.gruppen2.controllers; package mops.gruppen2.controllers;
import javax.annotation.security.RolesAllowed; import javax.annotation.security.RolesAllowed;
import mops.gruppen2.entities.Teilnehmer;
import mops.gruppen2.security.Account; import mops.gruppen2.security.Account;
import org.keycloak.KeycloakPrincipal; import org.keycloak.KeycloakPrincipal;
import org.keycloak.adapters.springsecurity.token.KeycloakAuthenticationToken; import org.keycloak.adapters.springsecurity.token.KeycloakAuthenticationToken;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.ui.Model; import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.context.annotation.SessionScope; import org.springframework.web.context.annotation.SessionScope;
@SessionScope @SessionScope
@ -41,4 +45,10 @@ public class Gruppen2Controller {
model.addAttribute("account", createAccountFromPrincipal(token)); model.addAttribute("account", createAccountFromPrincipal(token));
return "index"; return "index";
} }
@PostMapping("/")
public String addTeilnehmer(@ModelAttribute Teilnehmer teilnehmer) {
System.out.println(teilnehmer);
return "redirect:/";
}
} }

View File

@ -1,4 +1,8 @@
package mops.gruppen2.entities; package mops.gruppen2.entities;
public class Admin extends Teilnehmer{ public class Admin extends Teilnehmer{
public Admin(String vorname, String nachname) {
super(vorname, nachname);
}
} }

View File

@ -7,4 +7,8 @@ import java.util.List;
public class Student extends Teilnehmer{ public class Student extends Teilnehmer{
public Student(String vorname, String nachname) {
super(vorname, nachname);
}
} }

View File

@ -13,4 +13,9 @@ public class Teilnehmer {
String nachname; String nachname;
String email; String email;
List<Gruppe> Gruppen; List<Gruppe> Gruppen;
public Teilnehmer(String vorname, String nachname) {
this.vorname = vorname;
this.nachname = nachname;
}
} }

View File

@ -1,6 +1,6 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org" <html lang="en" xmlns:th="http://www.thymeleaf.org"
th:replace="~{mopslayout :: html(name='Name des Subsystems', headcontent=~{:: headcontent}, navigation=~{:: navigation}, bodycontent=~{:: bodycontent})}"> th:replace="~{mopslayout :: html(name='Gruppenbildung', headcontent=~{:: headcontent}, navigation=~{:: navigation}, bodycontent=~{:: bodycontent})}">
<head> <head>
<meta charset="utf-8"> <meta charset="utf-8">
<title>Name des Subsystems</title> <title>Name des Subsystems</title>
@ -15,7 +15,13 @@
</nav> </nav>
</header> </header>
<main th:fragment="bodycontent"> <main th:fragment="bodycontent">
<!-- Restlichen Inhalt hier einfügen! --> <form action="/" method="post">
<input th:name="${_csrf.parameterName}" th:value="${_csrf.token}" type="hidden">
<input th:value="${vorname}" type="text" id="vorname" placeholder="vorname">
<input th:value="${nachname}" type="text" id="nachname" placeholder="nachname">
<input type="email" id="mail" placeholder="mail">
<button type="submit">submit</button>
</form>
</main> </main>
</body> </body>
</html> </html>