So it's my html file:
getPass.html
<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="shortcut icon" type="image/jpg" href="../static/image/PUB_PIX_LION_K.jpg"
th:href="@{image/PUB_PIX_LION_K.jpg}">
<link href="../static/css/style.css" th:href="@{css/style.css}" rel="stylesheet" media="screen"/>
<title>PP-Secure</title>
</head>
<body>
<div class="wrapper-notification">
<h3>Password:</h3>
<p th:text="${dispPass}"></p>
<p th:text="${dispError}"></p>
</div>
</body>
</html>
And it is my Controller:
@RequestMapping("password/link/{enterId}")
public ModelAndView getPasswordById(@PathVariable("enterId") UUID uuid) {
ModelAndView mv = new ModelAndView();
if(passwordService.hasKey(uuid)) {
String passText = passwordService.getPassTextById(uuid).getPassText();
mv.addObject("dispPass",passText);
mv.setViewName("getPass");
} else {
String error = "No password available.";
mv.addObject("dispError",error);
mv.setViewName("getPass");
}
passwordService.removePasswordAfterVisit(uuid);
return mv;
}
The problem is when i use this URL (the Argument of the above @RequestMapping() ) the html page use neither of .css (styling) and the .jpg (logo in browser tab) so i tried everything and finally wrote a test mapping :
@GetMapping("test")
public String showGetPass(){
return "getPass";
}
And everything is ok with localhost:8080/test , i mean the logo appears in browser tab and the styling is there from .css
So my fast solution was that i packed all my .css file in <style></style>
tag in getPass.html ... but i was curious to know:
Is there any problem to have UUID as endpoint of a URL for a Get Request? I mean, does it make a problem for linking the css file in html file?
UPDATE:
It is working when i removed password/link/
in @RequestMapping
but what is wrong with xzy/jkj/{id} ?