81,092
社区成员
发帖
与我相关
我的任务
分享
//省略import *
@ParentPackage("struts-default")
@Results({ @Result(name = "success", type="freemarker", location = "/Pages/journalist.ftl"),
@Result(name = "error", location = "/1.jsp") })
public class Test extends ActionSupport {
@Resource(name="journalServiceImpl")
private JournalService journalservice;
public List<Journal> journalList = new ArrayList<Journal>();
@Action("list")
public String execute()
{
journalList=journalservice.getJournalList();
System.out.println("rrrrr");
return SUCCESS;
}
}
@Entity(name="journal")
@Repository
public class Journal {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int JournalId;
private String Title;
@ManyToOne(cascade=CascadeType.ALL,fetch=FetchType.EAGER)
@JoinColumn(name="userid")
private User Author;
private Date PublishTime;
private String Category;
@Lob
private String Content;
public int getJournalId() {
return JournalId;
}
public void setJournalId(int journalId) {
JournalId = journalId;
}
//省剩余getter setter
}
<html>
<head>
<meta charset="UTF-8">
<title>Hello word</title>
</head>
<body>
<#list journalList as j>
<tr>
<td>${j.JournalId}<td>
</tr>
</#list>
</body>
</html>
FreeMarker template error (HTML_DEBUG mode; use RETHROW in production!)
The following has evaluated to null or missing:
==> j.JournalId [in template "Pages/journalist.ftl" at line 13, column 15]
----
Tip: It's the step after the last dot that caused this error, not those before it.