Looking for SEW8b 4xHIT Spring Boot test answers and solutions? Browse our comprehensive collection of verified answers for SEW8b 4xHIT Spring Boot at elearning.tgm.ac.at.
Get instant access to accurate answers and detailed explanations for your course questions. Our community-driven platform helps students succeed!
Ergänzen Sie die fehlenden Annotationen zum Unterschied MVC vs. REST (wenn keine Annotation fehlt, wählen Sie die Option "leer").
.s0 { color: #0033b3;}
.s1 { color: #080808;}
.s2 { color: #067d17;}
.s3 { color: #8c8c8c; font-style: italic;}
.s4, .s4 input, .s4 input:focus { color: #9E880D; }
@RequestMapping("/user")public class UserController {
@GetMapping("/5")
public ModelAndView getUser5(@RequestParam String name) {
ModelAndView modelAndView = new ModelAndView();
modelAndView.setViewName("user");
modelAndView.addObject("name", name);
return modelAndView;
}
@GetMapping("/7")
public String getUser7(@RequestParam String name) {
return name;
}}
.s0 { color: #0033b3;}
.s1 { color: #080808;}
.s2 { color: #8c8c8c; font-style: italic;}
.s3 { color: #1750eb;}
.s4, .s4 input, .s4 input:focus { color: #9E880D; }
import jakarta.validation.constraints.*;public class UserDto {private Long id;
// Darf nicht nur aus Leerzeichen bestehen und maximal 100 Zeichen umfassen
private String name;
// Darf nicht leer sein, muss eine Mindestlänge von 5 Zeichen haben und muss das Schema einer Email erfüllen
private String email;
// Darf nicht null sein, muss zwischen den Werten 18 und 65 (inklusive) liegen
private Integer age;
// Constructor, Getter und Setter}
Ergänzen Sie die fehlenden Annotationen, indem Sie aus dem Namen der Methoden die gesuchte CRUD-Operation interpretieren und die dazu passende Annotation angeben.
.s0 { color: #0033b3;}
.s1 { color: #080808;}
.s2 { color: #067d17;}
.s3, .s3 input, .s3 input:focus { color: #9E880D;}
.s4 { color: #8C8C8C;}
("/user")public class UserController {("/{id}")
public ResponseEntity<UserDto> updateUserName( Long id, String name) {
throw new UnsupportedOperationException("Not supported yet.");
}
public ResponseEntity<List<UserDto>> listUsers() {
throw new UnsupportedOperationException("Not supported yet.");
}}
Welche Methoden müssen in DTOs mindestens existieren (impliziert erstellte Methoden zählen auch dazu), damit JSON De-/Serialisierung mit Jackson funktioniert:
.s0 { color: #0033b3;}
.s1 { color: #080808;}
.s2 { color: #067d17;}
.s4 { color: #8C8C8C;}
public class UserDto {// Beispiel zur Frage
private Long id;
private String name;
// ... gesuchte Methoden}
.s0, .s0 input, .s0 input:focus { color: #0033b3;}
.s1, .s1 input, .s1 input:focus { color: #080808;}
.s2, .s2 input, .s2 input:focus { color: #067d17;}
.s3, .s3 input, .s3 input:focus { color: #9E880D;}
.s4 { color: #8C8C8C;}
.s5 { color: #174AD4;}
.s6 { color: #871094;}
Ergänzen Sie die für Spring MVC mit Thymeleaf notwendigen Annotationen/Schlüsselwörter/Variablen/Literale (Pfad, z.B.: "/sayHello?name=Max").
public class HelloController {@GetMapping("/sayHello")
public sayHello( String name, xyz) {
xyz.addAttribute("name", name);
return ;
}}
hello.html
<!DOCTYPE HTMLBitte beantworten Sie alle Teile der Frage.>
<
html xmlns:th="http://www.thymeleaf.org">
<
body>
<
p th:text="|Hello, ${name}!|"/>
</
body>
</
html>
Get Unlimited Answers To Exam Questions - Install Crowdly Extension Now!