【问题标题】:Need display response which is a html code on the view page需要显示响应,这是视图页面上的 html 代码
【发布时间】:2019-05-21 22:57:43
【问题描述】:

我有一个来自后端的响应,它将显示在我的 html 页面上。我使用 thyeleaf 作为前端。后端响应本身就是一个 html 代码。在当前情况下,我的视图按原样显示该响应。我正在寻找的是让 html 响应以 html 格式显示,即没有那些 html、body 标签等,这样看起来会更好。

这是我的 html 响应,我需要在视图中以 html 格式显示。

<HTML> <HEAD></HEAD><BODY><PRE> Checking oracle status for instance jsx (performs a tnsping to jsx) ========================================================== jsx TNS failure - unable to test database status from server apsrs0170 Could not perform a database connection test from central server. Looks like TNS is not setup for this database. Please open up Additional Services Request for DBA group to fix the issue. ESC_SCRIPT_FAILURE

我需要使用此响应的 html 代码:

<tr>
    <th style="vertical-align: top">Message</th>
        <td th:text="${responseMessage}"></td>
</tr>

这里的 responseMessage 是 html 响应。

【问题讨论】:

标签: java html spring spring-boot


【解决方案1】:

你可以试试这样用吗?

<tr>
    <th style="vertical-align: top">Message</th>
        <td th:utext="${responseMessage}"></td>
</tr>

【讨论】:

  • 哇。我不知道它会那么容易。
猜你喜欢
  • 1970-01-01
  • 2014-02-05
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-05-27
  • 2020-01-09
  • 1970-01-01
  • 2020-04-20
相关资源
最近更新 更多