报错
Property ‘Id’ not found on type po.Song
数据库
po.Song
package po;
public class Song {
private int Id;
private String name;
private String singer;
private String special_edition;
private String picture;
private String lyric;
private String path;
public int getId() {
return Id;
}
public void setId(int id) {
Id = id;
}
public String getSinger() {
return singer;
}
public void setSinger(String singer) {
this.singer = singer;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getSpecial_edition() {
return special_edition;
}
public void setSpecial_edition(String special_edition) {
this.special_edition = special_edition;
}
public String getPicture() {
return picture;
}
public void setPicture(String picture) {
this.picture = picture;
}
public String getLyric() {
return lyric;
}
public void setLyric(String lyric) {
this.lyric = lyric;
}
public String getPath() {
return path;
}
public void setPath(String path) {
this.path = path;
}
}
jsp文件
<c:forEach items="${songList}" var="song">
<tr>
<td>${song.Id}</td>
<td>${song.name}</td>
<td>${song.singer}</td>
<td>${song.special_edition}</td>
<td>${song.picture}</td>
<td>${song.lyric}</td>
<td>${song.path}</td>
<td>
<a href="<c:url value="edit.action" />?Id=${song.getId()}">编辑</a>
</td>
</tr>
</c:forEach>
处理方法
<c:forEach items="${songList}" var="song">
<tr>
<td>${song.getId()}</td>
<td>${song.name}</td>
<td>${song.singer}</td>
<td>${song.special_edition}</td>
<td>${song.picture}</td>
<td>${song.lyric}</td>
<td>${song.path}</td>
<td>
<a href="<c:url value="edit.action" />?Id=${song.getId()}">编辑</a>
</td>
</tr>
</c:forEach>
Id改成getId()。。。不太明白为啥其他的信息都可以都是private啊。只是因为它是主键吗。