Skip to content
Snippets Groups Projects
Commit 59b732ef authored by Thomas Carrara's avatar Thomas Carrara
Browse files
parents b28d24f1 8fa7779e
Branches
No related tags found
No related merge requests found
Showing
with 100 additions and 31 deletions
......@@ -9,10 +9,10 @@ import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;
import com.tpKotlin.glhf.tpkotlin.entity.FavDir;
import com.tpKotlin.glhf.tpkotlin.entity.Meme;
import com.tpKotlin.glhf.tpkotlin.service.DossierFavService;
//import com.tpKotlin.glhf.tpkotlin.entity.Bidon;
@Controller
public class SimpleController {
......@@ -31,30 +31,29 @@ public class SimpleController {
@RequestMapping("/ex1")
public ModelAndView exo1() {
// String s = FavDir.affiche();
final String s = this.dfs.getAllImagesFromFavFASTER();
final ModelAndView mav = new ModelAndView("ex1", "msg", "Exercice 1");
String s = FavDir.affiche();
ModelAndView mav = new ModelAndView("ex1");
mav.addObject("dirfav", s );
return mav;
}
@RequestMapping("/ex2")
public ModelAndView exo2() {
return new ModelAndView("ex2", "msg", "Exercice 2");
return new ModelAndView("ex2", "formMeme", new Meme("", ""));
}
@RequestMapping("/ex3")
public ModelAndView exo3() {
return new ModelAndView("ex3", "msg", "Exercice 3");
return new ModelAndView("ex3");
}
@RequestMapping("/ex4")
public ModelAndView exo4() {
return new ModelAndView("ex4", "msg", "Exercice 4");
return new ModelAndView("ex4");
}
@RequestMapping("/ex5")
public ModelAndView exo5() {
return new ModelAndView("ex5", "msg", "Exercice 5");
return new ModelAndView("ex5");
}
}
package com.tpKotlin.glhf.tpkotlin.controller
import com.tpKotlin.glhf.tpkotlin.entity.Meme
import com.tpKotlin.glhf.tpkotlin.service.DossierFavService
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.stereotype.Controller
import org.springframework.web.bind.annotation.ModelAttribute
import org.springframework.web.bind.annotation.PostMapping
import org.springframework.web.bind.annotation.RequestMapping
import org.springframework.web.servlet.ModelAndView
@Controller
@RequestMapping("meme")
class MemeController {
@Autowired
lateinit var favService: DossierFavService
@PostMapping("/add")
fun addMeme(@ModelAttribute("formMeme") formMeme: Meme): ModelAndView {
favService.insertMeme(formMeme)
var mav = ModelAndView("ex2", "succeed", "true")
mav.addObject("formMeme", Meme("", ""))
return mav
}
}
\ No newline at end of file
package com.tpKotlin.glhf.tpkotlin.service
import com.tpKotlin.glhf.tpkotlin.entity.Meme
interface DossierFavService {
fun insertMeme(meme: Meme)
fun getAllImagesFromFav(): String
fun getAllImagesFromFavFASTER(): String
}
\ No newline at end of file
package com.tpKotlin.glhf.tpkotlin.service
import org.springframework.beans.factory.annotation.Autowired
import com.tpKotlin.glhf.tpkotlin.dao.ImageAccessorDao
import kotlinx.coroutines.*
import com.tpKotlin.glhf.tpkotlin.entity.FavDir
import com.tpKotlin.glhf.tpkotlin.entity.Meme
import org.springframework.stereotype.Service
import com.tpKotlin.glhf.tpkotlin.dao.ImageAccessorDaoImpl
import org.springframework.beans.factory.annotation.Autowired
@Service
class DossierFavServiceImpl : DossierFavService {
......@@ -14,6 +15,11 @@ class DossierFavServiceImpl : DossierFavService {
@Autowired
lateinit var imgDao: ImageAccessorDao
//méthode check + ajout exo 2
override fun insertMeme(meme: Meme) {
FavDir.addMeme(meme)
}
//Truc lent pour l'exo 3
override fun getAllImagesFromFav(): String {
var liste = FavDir.getAll()
......
......@@ -13,3 +13,18 @@ test https://i.pinimg.com/originals/5e/df/c6/5edfc6638e8068fcae834432e5ef8d33.jp
meme1 https://media.giphy.com/media/QyWBTLDn9WHt0FXGJS/200w_d.gif
test https://i.pinimg.com/originals/5e/df/c6/5edfc6638e8068fcae834432e5ef8d33.jpg
meme1 https://media.giphy.com/media/QyWBTLDn9WHt0FXGJS/200w_d.gif
Ricardo Milos https://tenor.com/3KGh.gif
Ricardo Milos https://tenor.com/3KGh.gif
Ricardo Milos https://tenor.com/3KGh.gif
Ricardo Milos https://tenor.com/3KGh.gif
Ricardo Milos https://tenor.com/3KGh.gif
Ricardo Milos https://tenor.com/3KGh.gif
Ricardo Milos https://tenor.com/3KGh.gif
Ricardo Milos https://tenor.com/3KGh.gif
Ricardo Milos https://tenor.com/3KGh.gif
Ricardo Milos https://tenor.com/3KGh.gif
Ricardo Milos https://tenor.com/3KGh.gif
Ricardo Milos https://tenor.com/3KGh.gif
Ricardo Milos https://tenor.com/3KGh.gif
Ricardo Milos https://tenor.com/3KGh.gif
autre test
\ No newline at end of file
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<c:import url="/WEB-INF/jsp/header.jsp" />
<title>${msg}</title>
<title>Exercice 2</title>
</head>
<body>
<h1 class="content-title">Exercice 2 : TBD</h1>
......@@ -14,13 +15,13 @@
<h3 class="content-sub-title">Saisie d'un nouveau Meme : </h3>
<br><br>
<div class="container-fluid">
<form action="/tbd" style="padding-left: 20px;">
<form:form method="POST" action="/meme/add" modelAttribute="formMeme">
<div class="row">
<div class="col-sm-2 offset-md-4">
Meme name:
</div>
<div class="col-sm-auto">
<input type="text" name="Name" placeholder="Nom">
<form:input type="text" path="nom" placeholder="Nom"/>
</div>
</div><br>
<div class="row">
......@@ -28,15 +29,26 @@
URL img:
</div>
<div class="col-sm-auto">
<input type="text" name="URL" placeholder="URL de l'image">
<form:input type="text" path="url" placeholder="URL de l'image"/>
</div>
</div><br>
<div class="row">
<div class="col-sm-4 offset-md-4 center">
<input type="submit" value="Submit">
<input type="submit" value="Submit"/>
</div>
</div>
</form>
</form:form><br>
<c:choose>
<c:when test="${not empty succeed}">
<div class="row">
<div class="col-sm-12">
<h2 class="success center">
Meme ajouté avec succ&eacute;s !
</h2>
</div>
</div>
</c:when>
</c:choose>
</div>
</body>
</html>
\ No newline at end of file
......@@ -6,7 +6,7 @@
<head>
<meta charset="UTF-8">
<c:import url="/WEB-INF/jsp/header.jsp" />
<title>${msg}</title>
<title>Exercice 3</title>
</head>
<body>
<c:import url="/WEB-INF/jsp/footer.jsp" />
......
......@@ -6,10 +6,10 @@
<head>
<meta charset="UTF-8">
<c:import url="/WEB-INF/jsp/header.jsp" />
<title>${msg}</title>
<title>Exercice 4</title>
</head>
<body>
<h1 class="content-title">Exercice 4 : Les coroutines</h1>
<h1 class="content-title">Exercice 4 : Les Coroutines</h1>
<br>
<h3 class="content-sub-title">EEEEEEEEHHHHHHHHHHH </h3>
<br><br>
......
......@@ -6,7 +6,7 @@
<head>
<meta charset="UTF-8">
<c:import url="/WEB-INF/jsp/header.jsp" />
<title>${msg}</title>
<title>Exercice 5</title>
</head>
<body>
......
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" rel="stylesheet">
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<link href="./css/header.css" rel="stylesheet" type="text/css">
<link href="./css/content.css" rel="stylesheet" type="text/css">
<link href="/css/header.css" rel="stylesheet" type="text/css">
<link href="/css/content.css" rel="stylesheet" type="text/css">
<link rel="icon" type="image/png" href="https://upload.wikimedia.org/wikipedia/commons/thumb/7/74/Kotlin-logo.svg/1024px-Kotlin-logo.svg.png" />
<nav class="nav-bar">
<div class="container bar-content">
......@@ -15,7 +15,7 @@
<div class="onglet"><a href="/ex1">Exercice 1</a></br><p>Singleton</p></div>
<div class="onglet"><a href="/ex2">Exercice 2</a></br><p>TBD</p></div>
<div class="onglet"><a href="/ex3">Exercice 3</a></br><p>Null Safety</p></div>
<div class="onglet"><a href="/ex4">Exercice 4</a></br><p></p></div>
<div class="onglet"><a href="/ex4">Exercice 4</a></br><p>Les Coroutines</p></div>
<div class="onglet"><a href="/ex5">Exercice 5</a></br><p></p></div>
</div>
</nav>
......
......@@ -17,9 +17,9 @@
<div class="row justify-content-center">
<div class="col-md-7">
<p class="center">
Voici le TP Kotlin que tout le monde attendez ! (C'est le cas hein ?) <br><br>
Voici le TP Kotlin que tout le monde attendez ! (C'est le cas hein ?) <br>
Pour vous aider au cours de ces exercices fabuleux, trois coll&egrave;gues sont la pour vous donner un coup de main
ou des indications.<br><br>
ou des indications.<br>
Bien &eacute;videmment vous savez comment s'appellent ces trois personnes.<br> Mais on va quand m&ecirc;me vous donner leurs noms au cas
ou vous auriez un trou de m&eacute;moire.
</p>
......@@ -29,10 +29,17 @@
<div class="col-md-8">
<ul>
<li>Thomas (Le mec grand, dark, avec une barbe)</li>
<li>Nicolas (Il a des lunettes mais il peut quand m&ecirc;me te p&eacute;ter la gueule Ok ?!)</li>
<li>Nicolas (Il a des lunettes)</li>
<li>Valentin (Le dernier, tu devrais &ecirc;tre capable de deviner qui c'est)</li>
</ul>
</div>
</div><br>
<div class="row justify-content-center">
<div class="col-md-8">
<p class="center">
Maintenant on vous laisse commencer avec le premier exercice (regarde, le lien est dans la NavBar).
</p>
</div>
</div>
</div>
</div>
......
......@@ -6,10 +6,6 @@
margin-left: 5%;
}
.content {
text-align: center;
}
.center {
text-align: center;
}
......@@ -21,3 +17,7 @@
display: flex;
align-items: center;
}
.success {
color: green;
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment