저는 자바 웹 초보자입니다. spring4 mvc와 mybatis를 사용하여 책 관리 시스템을 사용하고 있습니다.
두 테이블 t_book와 MySQL의 데이터베이스 BMS의 t_type있다.
public class Type {
private Long sortId;
private String sortName;
// getter and setter
}
그러나 bookDetail.jsp에서
, 페이지 이이 값을 표시 할 수 있습니다 :public class Book {
private Long bookNum;
private String bookName;
private String writer;
private String callNumber;
private BigDecimal price;
private String pubCompany;
private Date pubDate;
private Long totalNum;
private Long currentNum;
private String brief;
private Type type; // the associated class
// getter and setter
}
이것은 유형 엔티티는 다음과 같습니다
이
은 책 실체 $ {book.bookName}, $ {book.writer}, $ {book.pubDate} 등과 같이 표시되지만 은의 값을 표시 할 수 없습니다. $ {book.txt.sortName}.<table class="table table-bordered table-striped">
<tr>
<th>Book ID</th>
<td>${book.bookNum}</td>
</tr>
<tr>
<th>Book name</th>
<td>${book.bookName}</td>
</tr>
<tr>
<th>Book writer</th>
<td>${book.writer}</td>
</tr>
<tr>
<th>callNumber</th>
<td>${book.callNumber}</td>
</tr>
<tr>
<th>sort</th>
<td>${book.type.sortName}</td>
</tr>
<tr>
<th>publish Date</th>
<td><fmt:formatDate value="${book.pubDate}" pattern="yyyy-MM-dd"/></td>
</tr>
</table>
가 왜 .jsp로의 {book.type.sortName} $을 통해 관련 데이터의 값을 얻을 수 없습니다
이 bookDetail.jsp의 일부인가? 그것을 어떻게 얻을 수 있습니까?
도와주세요! 미리 감사드립니다.
아니, 나는 또한 $ {book.type}의 값을 얻을 수 없다 : 당신의 SQL 매핑 XML의 – Sherry