Reputation: 6084
I have a Spring Boot
based application that displays some data in tabular format.
I would like to display some values on two different lines but within the same <td>
. Something like this.
Mule: Down
TC: Down
ServerService.java
public String getServerStatus(String kdn, String hostname, String serverType) {
String muleStatus = getMuleStatus(hostname, MULE_DEV_STATUS_SSH_CMD);
String tcStatus = getTCStatus(hostname);
serverStatus = muleStatus + "<br/>" + tcStatus;
return serverStatus;
}
From the service class mentioned above, I changed my logic to return a String
that looks like this: TC: Down <br/> Mule: Down
, hoping that the browser would automatically parse this HTML
tag
and will display the contents on two different lines within the same column. But that didn't work.
Hence I added <td th:text="${#strings.escapeXml(appDeploy.server.status)}">001</td>
in my server.html
file but that also didn't help and in the browser I see something like this.
Mule: DOWN<br/>TC: DOWN
Not sure what else is missing.
Upvotes: 1
Views: 1365
Reputation: 81
If your purpose just make it break to two lines in Thymeleaf, you should change th:text to th:utext.
<td th:text="${appDeploy.server.status}"></td>
Be like:
<td th:utext="${appDeploy.server.status}"></td>
Upvotes: 1