저는 Spring, Thymeleaf 및 jOOQ에 익숙하지 않습니다. 개요에서 데이터베이스 조회의 결과를 표시하려고합니다. Select(). (CONFIGURATIONS)에서 쿼리 할 때 Thymeleaf 뷰는 정상적으로 작동합니다. 그러나 사용자 테이블에 가입하여 id 대신 결과에 사용자 이름을 추가하려고하면 오류가 발생합니다. 중부 유럽 표준시 16시 04분 17초 2016 Thymeleaf보기에서 jOOQ join 쿼리의 속성/필드를 찾을 수 없습니다.
월 년 10 월 10 예기치 않은 오류 (유형 = 내부 서버 오류, 상태 = 500)가 발생했습니다
이
는 웹 브라우저에서 오류가 발생합니다. 예외 평가 SpringEL 식 "config.name"(개요 : 37) :org.springframework.expression.spel.SpelEvaluationException : EL1008E :
이 이클립스에서 오류가 POS (7) : 'org.jooq.impl.RecordImpl'유형의 객체에서 'name'속성 또는 필드를 찾을 수 없습니다. 공개가 아닐 수도 있습니다.
내보기 코드가 잘못되었지만 올바른 "property.field"를 얻기 위해 "config.name"을 어떻게 변경해야하는지 모르겠습니다.
이 내 컨트롤러 :
@Controller
public class OverviewController
{
public ArrayList configurationList = new ArrayList();
@RequestMapping("/overview")
public String showConfigurationList(Model model)
{
model.addAttribute("configs", getConfigurations());
return "overview";
}
public ArrayList getConfigurations()
{
try (Connection conn = DriverManager.getConnection(dbUrl, dbUserName, dbPassword))
{
DSLContext create = DSL.using(conn, SQLDialect.POSTGRES_9_5);
Result<Record5<String, String, Timestamp, String, String>> result = create.select(CONFIGURATION.NAME, CONFIGURATION.VERSION, CONFIGURATION.DATE_MODIFIED, CONFIGURATION.AUTHOR_USER_ID, USER.NAME)
.from(USER).join(CONFIGURATION)
.on(CONFIGURATION.AUTHOR_USER_ID.equal(USER.ID)))
.fetch();
/*Result<Record> result = create.select()
.from(CONFIGURATION)
.fetch();*/
if(configurationList.isEmpty() == true)
{
for (Record5 r : result) {
configurationList.add(r);
}
}
}
catch (Exception e)
{
System.out.println("ERROR: " + e);
}
return configurationList;
}
그리고 이것은 Thymeleaf보기입니다 :
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:th="http://www.thymeleaf.org">
<head>
<title>Nazza Mediator - Overview</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="stylesheet" href="webjars/bootstrap/3.3.7-1/css/bootstrap.min.css" />
<script src="http://code.jquery.com/jquery.js" />
<script src="webjars/bootstrap/3.3.7-1/js/bootstrap.min.js" />
</head>
<body>
<nav class="navbar navbar-default">
<div class="container-fluid">
<div class="navbar-header">
<a class="navbar-brand" href="/">Nazza Mediator</a>
</div>
<ul class="nav navbar-nav">
<li><a href="/">Home</a></li>
<li class="active"><a href="/overview">Configuration Overview</a></li>
</ul>
</div>
</nav>
<h3>Configuration Overview</h3>
<table class="table table-hover">
<tr>
<th>NAME</th>
<th>VERSION</th>
<th>DATE MODIFIED</th>
<th>AUTHOR</th>
</tr>
<tr th:each="config : ${configs}">
<td th:text="${config.name}"></td>
<td th:text="${config.version}"></td>
<td th:text="${config.dateModified}"></td>
<td th:text="${config.authorUserId}"></td>
</tr>
</table>
</body>
</html>
예, 작동했습니다. 해결책을 가져 주셔서 감사 드리며 설명해 주셔서 대단히 감사합니다. 이제 코드가 작동하지 않는 이유를 알았습니다. – Kailayla