Java ThymileAF无法获取对象中的列表
下面使用Thymeleaf模板引擎的html片段并不像我期望的那样工作${value}不打印名为rowList的列表中的字符串值,而是打印:…api.model。Row@46b222d 值如箭头所示为列表 行:Java ThymileAF无法获取对象中的列表,java,thymeleaf,Java,Thymeleaf,下面使用Thymeleaf模板引擎的html片段并不像我期望的那样工作${value}不打印名为rowList的列表中的字符串值,而是打印:…api.model。Row@46b222d 值如箭头所示为列表 行: public class Row { private List<String> rowList; private String uniqueId; public Row(List<String> rowList, String uniqu
public class Row {
private List<String> rowList;
private String uniqueId;
public Row(List<String> rowList, String uniqueId) {
this.rowList = rowList;
this.uniqueId = uniqueId;
}
public List<String> getRowList() {
return rowList;
}
public void setRowList(List<String> rowList) {
this.rowList = rowList;
}
public String getUniqueId() {
return uniqueId;
}
public void setUniqueId(String uniqueId) {
this.uniqueId = uniqueId;
}
}
您认为可能是什么问题?结果表明,我的一个方法中存在问题,并且我给出了错误的视图名称,因此我的更改不起作用 对于任何查看此问题的人,上面的代码都有效。你显然可以做到
感谢所有想到这一点的人。无论如何,你都应该覆盖toString,这通常是一个好习惯
public class Row {
private List<String> rowList;
private String uniqueId;
public Row(List<String> rowList, String uniqueId) {
this.rowList = rowList;
this.uniqueId = uniqueId;
}
public List<String> getRowList() {
return rowList;
}
public void setRowList(List<String> rowList) {
this.rowList = rowList;
}
public String getUniqueId() {
return uniqueId;
}
public void setUniqueId(String uniqueId) {
this.uniqueId = uniqueId;
}
}