你知道为什么我的应用程序会抛出这个异常:
WARNING: /myProfile.xhtml @71,27 target="#{profileBean.selectedUser}": Property 'selectedUser' not found on type bg.fmi.master.thesis.beans.ProfileBean
javax.el.PropertyNotFoundException: /myProfile.xhtml @71,27 target="#{profileBean.selectedUser}": Property 'selectedUser' not found on type bg.fmi.master.thesis.beans.ProfileBean
---
Caused by: javax.el.PropertyNotFoundException: Property 'selectedUser' not found on type bg.fmi.master.thesis.beans.ProfileBean
当我在我的bean中有这个属性时:
@ManagedBean(name = "profileBean")
public class ProfileBean implements Serializable {
private TUser selectedUser = new TUser();
public TUser getSelectedUser() {
return selectedUser;
}
public void setSelectedUser(TUser selectedUser) {
this.selectedUser = selectedUser;
}
.xhtml代码是这样的:
<p:dataGrid var="user" value="#{profileBean.userList}">
<p:panelGrid columns="2">
....
<p:commandButton id="submit" value="Save changes" actionListener="#{profileBean.editUser()}" >
<f:setPropertyActionListener target="#{profileBean.selectedUser}" value="#{user}" />
</p:commandButton>
</p:dataGrid>
提前致谢!
答案 0 :(得分:1)
我根据您的示例代码制作了一个简单的项目。
<h:form>
<p:commandButton id="submit" value="Save changes" actionListener="#{profileBean.editUser()}" >
<f:setPropertyActionListener target="#{profileBean.selectedUser}" value="#{user}" />
</p:commandButton>
</h:form>
没有描述的错误。你的问题来自其他地方。删除不必要的位并尝试隔离问题。您可以更改属性的名称,并查看错误是否反映了新名称。确保你没有另一个同名的bean。