bootstrap css file and jquery js file are not linked in thymeleaf header file
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
I am a newbie of spring boot. The below image shows the folder location of my bootstrap css file and jquery js file on spring boot thymeleaf template.
And these are my home html scripts
<html xmlns:th="http://www.thymeleaf.org"
xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity4">
<head>
<div th:fragment="header-css">
<title>Spring Boot Blog</title>
<script th:src="@/js/jquery-2.1.4.min.js"></script>
<link rel="stylesheet" type="text/css" href="/css/bootstrap.min.css" th:href="@/css/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="/css/main.css" th:href="@/css/main.css" />
</div>
</head>
<body>
<div th:fragment="header">
.....
But css and js scripts are not linked at all.
Any idea, please!
== UPDATED ==
I am evaluating the spring blog example. I think my problem is related to login controller. First this is the login controller codes.
@Controller
public class LoginController
@GetMapping("/login")
public String login(Principal principal)
String username = (principal != null ? principal.getName() : "ANONYMOUS");
if(principal != null)
return "redirect:/home";
// ALWAYS PRINTING "ANONYMOUS is WRONG!!!!"
System.out.println(username + " is WRONG!!!!");
return "/login";
And even more
return "/login"
line brings wrong files. In below login.html file,
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head>
<div th:replace="/fragments/header :: header-css"/>
</head>
<body>
<div th:replace="/fragments/header :: header"/>
<div class="container">
<div class="row" style="margin-top:20px">
<div class="col-xs-12 col-sm-8 col-md-6 col-sm-offset-2 col-md-offset-3">
<form th:action="@/login" method="post">
<fieldset>
the controller call the following css file and display its contents.
<link rel="stylesheet" type="text/css" href="/css/main.css" th:href="@/css/main.css" />
html thymeleaf
add a comment |
I am a newbie of spring boot. The below image shows the folder location of my bootstrap css file and jquery js file on spring boot thymeleaf template.
And these are my home html scripts
<html xmlns:th="http://www.thymeleaf.org"
xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity4">
<head>
<div th:fragment="header-css">
<title>Spring Boot Blog</title>
<script th:src="@/js/jquery-2.1.4.min.js"></script>
<link rel="stylesheet" type="text/css" href="/css/bootstrap.min.css" th:href="@/css/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="/css/main.css" th:href="@/css/main.css" />
</div>
</head>
<body>
<div th:fragment="header">
.....
But css and js scripts are not linked at all.
Any idea, please!
== UPDATED ==
I am evaluating the spring blog example. I think my problem is related to login controller. First this is the login controller codes.
@Controller
public class LoginController
@GetMapping("/login")
public String login(Principal principal)
String username = (principal != null ? principal.getName() : "ANONYMOUS");
if(principal != null)
return "redirect:/home";
// ALWAYS PRINTING "ANONYMOUS is WRONG!!!!"
System.out.println(username + " is WRONG!!!!");
return "/login";
And even more
return "/login"
line brings wrong files. In below login.html file,
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head>
<div th:replace="/fragments/header :: header-css"/>
</head>
<body>
<div th:replace="/fragments/header :: header"/>
<div class="container">
<div class="row" style="margin-top:20px">
<div class="col-xs-12 col-sm-8 col-md-6 col-sm-offset-2 col-md-offset-3">
<form th:action="@/login" method="post">
<fieldset>
the controller call the following css file and display its contents.
<link rel="stylesheet" type="text/css" href="/css/main.css" th:href="@/css/main.css" />
html thymeleaf
Well your code looks all right. Could you share your Thymeleaf configuration? Also, if you are using Spring Security there is a special configuration you must add to be able to link resources. So maybe also add your Spring Security configuration?
– Alain Cruz
Nov 15 '18 at 11:48
Thanks for reply, Please check the updated part.
– Joseph Hwang
Nov 17 '18 at 9:52
add a comment |
I am a newbie of spring boot. The below image shows the folder location of my bootstrap css file and jquery js file on spring boot thymeleaf template.
And these are my home html scripts
<html xmlns:th="http://www.thymeleaf.org"
xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity4">
<head>
<div th:fragment="header-css">
<title>Spring Boot Blog</title>
<script th:src="@/js/jquery-2.1.4.min.js"></script>
<link rel="stylesheet" type="text/css" href="/css/bootstrap.min.css" th:href="@/css/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="/css/main.css" th:href="@/css/main.css" />
</div>
</head>
<body>
<div th:fragment="header">
.....
But css and js scripts are not linked at all.
Any idea, please!
== UPDATED ==
I am evaluating the spring blog example. I think my problem is related to login controller. First this is the login controller codes.
@Controller
public class LoginController
@GetMapping("/login")
public String login(Principal principal)
String username = (principal != null ? principal.getName() : "ANONYMOUS");
if(principal != null)
return "redirect:/home";
// ALWAYS PRINTING "ANONYMOUS is WRONG!!!!"
System.out.println(username + " is WRONG!!!!");
return "/login";
And even more
return "/login"
line brings wrong files. In below login.html file,
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head>
<div th:replace="/fragments/header :: header-css"/>
</head>
<body>
<div th:replace="/fragments/header :: header"/>
<div class="container">
<div class="row" style="margin-top:20px">
<div class="col-xs-12 col-sm-8 col-md-6 col-sm-offset-2 col-md-offset-3">
<form th:action="@/login" method="post">
<fieldset>
the controller call the following css file and display its contents.
<link rel="stylesheet" type="text/css" href="/css/main.css" th:href="@/css/main.css" />
html thymeleaf
I am a newbie of spring boot. The below image shows the folder location of my bootstrap css file and jquery js file on spring boot thymeleaf template.
And these are my home html scripts
<html xmlns:th="http://www.thymeleaf.org"
xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity4">
<head>
<div th:fragment="header-css">
<title>Spring Boot Blog</title>
<script th:src="@/js/jquery-2.1.4.min.js"></script>
<link rel="stylesheet" type="text/css" href="/css/bootstrap.min.css" th:href="@/css/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="/css/main.css" th:href="@/css/main.css" />
</div>
</head>
<body>
<div th:fragment="header">
.....
But css and js scripts are not linked at all.
Any idea, please!
== UPDATED ==
I am evaluating the spring blog example. I think my problem is related to login controller. First this is the login controller codes.
@Controller
public class LoginController
@GetMapping("/login")
public String login(Principal principal)
String username = (principal != null ? principal.getName() : "ANONYMOUS");
if(principal != null)
return "redirect:/home";
// ALWAYS PRINTING "ANONYMOUS is WRONG!!!!"
System.out.println(username + " is WRONG!!!!");
return "/login";
And even more
return "/login"
line brings wrong files. In below login.html file,
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head>
<div th:replace="/fragments/header :: header-css"/>
</head>
<body>
<div th:replace="/fragments/header :: header"/>
<div class="container">
<div class="row" style="margin-top:20px">
<div class="col-xs-12 col-sm-8 col-md-6 col-sm-offset-2 col-md-offset-3">
<form th:action="@/login" method="post">
<fieldset>
the controller call the following css file and display its contents.
<link rel="stylesheet" type="text/css" href="/css/main.css" th:href="@/css/main.css" />
html thymeleaf
html thymeleaf
edited Nov 17 '18 at 9:49
Joseph Hwang
asked Nov 15 '18 at 7:14
Joseph HwangJoseph Hwang
4331926
4331926
Well your code looks all right. Could you share your Thymeleaf configuration? Also, if you are using Spring Security there is a special configuration you must add to be able to link resources. So maybe also add your Spring Security configuration?
– Alain Cruz
Nov 15 '18 at 11:48
Thanks for reply, Please check the updated part.
– Joseph Hwang
Nov 17 '18 at 9:52
add a comment |
Well your code looks all right. Could you share your Thymeleaf configuration? Also, if you are using Spring Security there is a special configuration you must add to be able to link resources. So maybe also add your Spring Security configuration?
– Alain Cruz
Nov 15 '18 at 11:48
Thanks for reply, Please check the updated part.
– Joseph Hwang
Nov 17 '18 at 9:52
Well your code looks all right. Could you share your Thymeleaf configuration? Also, if you are using Spring Security there is a special configuration you must add to be able to link resources. So maybe also add your Spring Security configuration?
– Alain Cruz
Nov 15 '18 at 11:48
Well your code looks all right. Could you share your Thymeleaf configuration? Also, if you are using Spring Security there is a special configuration you must add to be able to link resources. So maybe also add your Spring Security configuration?
– Alain Cruz
Nov 15 '18 at 11:48
Thanks for reply, Please check the updated part.
– Joseph Hwang
Nov 17 '18 at 9:52
Thanks for reply, Please check the updated part.
– Joseph Hwang
Nov 17 '18 at 9:52
add a comment |
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53314186%2fbootstrap-css-file-and-jquery-js-file-are-not-linked-in-thymeleaf-header-file%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53314186%2fbootstrap-css-file-and-jquery-js-file-are-not-linked-in-thymeleaf-header-file%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Well your code looks all right. Could you share your Thymeleaf configuration? Also, if you are using Spring Security there is a special configuration you must add to be able to link resources. So maybe also add your Spring Security configuration?
– Alain Cruz
Nov 15 '18 at 11:48
Thanks for reply, Please check the updated part.
– Joseph Hwang
Nov 17 '18 at 9:52