I use thymeleaf and spring. I try to do inline javascript.
<script th:inline="javascript">
$("#genericTable").bootstrapTable({
url: /*[[${url}]]*/ 'generic',
...
});
On the server side I do
model.addAttribute("url", "/rest/vehicles");
I get
url: "\/rest\/vehicles",
Why some caracters are added to the string?
Edit
with
url: /*[[@{${url}}]]*/ 'generic',
first / is like removed, so it's invalid to call...
[(...)]
should help
Example with problem I am facing:
$.getJSON('[[@{/management/users/search/unit/}]]' + value, function(data) {
Is transformed to:
$.getJSON('"\/management\/users\/search\/unit\/"' + value, function(data) {
Using [(...)]
:
$.getJSON('[(@{/management/users/search/unit/})]' + value, function(data) {
Is transformed to:
$.getJSON('/management/users/search/unit/' + value, function(data) {
From Thymeleaf 3.0 docs
Note that, while [[...]] corresponds to th:text (i.e. result will be HTML-escaped), [(...)] corresponds to th:utext and will not perform any HTML-escaping.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With