added index.html
This commit is contained in:
@ -1,12 +1,16 @@
|
||||
package mops.gruppen2.controllers;
|
||||
|
||||
import javax.annotation.security.RolesAllowed;
|
||||
|
||||
import mops.gruppen2.entities.Teilnehmer;
|
||||
import mops.gruppen2.security.Account;
|
||||
import org.keycloak.KeycloakPrincipal;
|
||||
import org.keycloak.adapters.springsecurity.token.KeycloakAuthenticationToken;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
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;
|
||||
|
||||
@SessionScope
|
||||
@ -41,4 +45,10 @@ public class Gruppen2Controller {
|
||||
model.addAttribute("account", createAccountFromPrincipal(token));
|
||||
return "index";
|
||||
}
|
||||
|
||||
@PostMapping("/")
|
||||
public String addTeilnehmer(@ModelAttribute Teilnehmer teilnehmer) {
|
||||
System.out.println(teilnehmer);
|
||||
return "redirect:/";
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,4 +1,8 @@
|
||||
package mops.gruppen2.entities;
|
||||
|
||||
public class Admin extends Teilnehmer{
|
||||
|
||||
public Admin(String vorname, String nachname) {
|
||||
super(vorname, nachname);
|
||||
}
|
||||
}
|
||||
|
||||
@ -7,4 +7,8 @@ import java.util.List;
|
||||
|
||||
public class Student extends Teilnehmer{
|
||||
|
||||
public Student(String vorname, String nachname) {
|
||||
super(vorname, nachname);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -13,4 +13,9 @@ public class Teilnehmer {
|
||||
String nachname;
|
||||
String email;
|
||||
List<Gruppe> Gruppen;
|
||||
|
||||
public Teilnehmer(String vorname, String nachname) {
|
||||
this.vorname = vorname;
|
||||
this.nachname = nachname;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
<!DOCTYPE html>
|
||||
<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>
|
||||
<meta charset="utf-8">
|
||||
<title>Name des Subsystems</title>
|
||||
@ -15,7 +15,13 @@
|
||||
</nav>
|
||||
</header>
|
||||
<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>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user