我在这里看到了大量类似的问题,但他们没有给我一个答案,可能我错过了一个,这涵盖了我的情况。所以这是产生异常的代码部分:
<c:forEach var="srPeer" items="${preset_groups}">
$("#preset_checkbox_" + "<c:out value='${srPeer.srPeerPK.peerGroupId}' />").attr("checked", true);
</c:forEach>
javax.el.PropertyNotFoundException: Property 'srPeerPK' not found on type java.lang.String
preset_groups
变量存储在会话中。我以这种方式开始:
Set<SrPeer> presetGroups = srPeerDao.findSelectedPresetPeerGroupsByFirm(intFirmID);
session.setAttribute(SessionAttributes.PRESET_GROUPS, presetGroups);
SrPeer
上课:
@Entity
@Table(name = "SR_PEERS")
public class SrPeer implements Serializable {
private static final long serialVersionUID = -6119498549478635542L;
@EmbeddedId
private SrPeerPK srPeerPK;
@Column(name = "PEERGROUPNAME_UI")
private String peerGroupNameUi;
@Column(name = "PEER_FIRM_DATA_VALID")
private String peerFirmDataValid;
@Column(name = "PEER_FIRM_NAME")
private String peerFirmName;
@Column(name = "REPORT_VERSION")
private String reportVersion;
//Getters and Setters
}
SrPeerPK
上课:
@Embeddable
public class SrPeerPK implements Serializable {
private static final long serialVersionUID = -4539516420308504052L;
@Column(name = "FIRM_ID")
private Integer firmId;
@Column(name = "PEERGROUP_ID")
private Integer peerGroupId;
@Column(name = "PEER_FIRM_ID")
private Integer peerFirmId;
//Getters and Setters
}
有什么猜测是什么问题?