0

我在 openshift (tomcat 7) 上部署我的 webapp,但出现错误:

HTTP Status 500 - Request processing failed; nested exception is  org.thymeleaf.exceptions.TemplateInputException: Exception parsing document: template="null", line 2 - column 23 (dodaj:42)
org.xml.sax.SAXParseException; lineNumber: 2; columnNumber: 23; The entity name must immediately follow the '&' in the entity reference.

以及此错误的代码:

<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
<meta charset="utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
<title></title>
<meta name="description" content="HTML 5 CSS 3 Spring Form"/>
<meta name="viewport" content="width=device-width,initial-scale=1"/>
<link rel="stylesheet" href="../../css/style.css" th:href="@{/css/style.css}"/> 
<script src="../../js/libs/modernizr-2.0.6.min.js" th:src="@{/js/libs/modernizr- 2.0.6.min.js}"></script>
</head>
............
<tr>
    <td width="100px"><b>CATEGORY:</b></td>
    <td width="400px">
      <select th:field="*{category.name}" >
(this is line 42)   <option th:each="c : ${category}" th:value="${c.name}" th:utext="${c.name}">

    </option>
    </select>

    </tr>

我搜索了解决方案,但没有找到。在我的本地主机上工作正常。也许有人有类似的问题。谢谢

4

1 回答 1

1

我解决了这个问题。问题出在我的数据库中。在类别名称中,我得到了例如“教育与科学”和百里香在`中遇到了“&”的问题:

<option th:each="c : ${category}" th:value="${c.name}" th:utext="${c.name}">

我将其更改为“和”并且一切正常。

于 2013-09-03T09:50:39.860 回答