question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Thymeleaf seems to be escaping the & character while rendering the th::href attribute and also adding a shape attribute (?)

See original GitHub issue

I don’t know if I am doing something wrong, but there seems to be a bug while rendering the th::href attribute using the @{…} syntax.

<a th:href="@{/foo/bar(bug='y',ornot='f')}" href="#"></a>

The result I am getting is:

<a href="/foo/bar?bug=y&amp;ornot=f" shape="rect"></a>

It’s escaping the ‘&’ character and adding a shape attribute.

Please! I really need a fix… I am using it everywhere. =(

Issue Analytics

  • State:closed
  • Created 10 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
jmiguelsampercommented, Jul 12, 2013

Escaping ampersand inside an attribute is correct HTML.

1reaction
jmiguelsampercommented, Jul 12, 2013

Thymeleaf has its own syntax for URL parameters, look at http://www.thymeleaf.org/doc/html/Using-Thymeleaf.html#link-urls

Read more comments on GitHub >

github_iconTop Results From Across the Web

Tutorial: Using Thymeleaf
If we want Thymeleaf to respect our XHTML tags and not escape them, we will have to use a different attribute: th:utext (for...
Read more >
Escaping '&' character in thymeleaf - Stack Overflow
The way that you escape an ampersand & in any html attribute is & . Actually you should always escape ampersands in all...
Read more >
Using-Thymeleaf_百度文库
The main goal of Thymeleaf is to provide an elegant and well-formed way of creating templates. In order to achieve this, it is...
Read more >
Spring in Action
is called when the knight's embarkOnQuest() method is called. ... as the first character of an attribute, I had to add an underscore...
Read more >
Spring in Action, 4th Edition: Covers Spring 4 (2015)
Chapter 6. Rendering web views. This chapter covers. · Rendering model data as HTML. · Using JSP views. · Defining view layout with...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found