Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/jsf/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jsf-2/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jsf javax.el.PropertyNotFoundException:Property';选择用户';在bg.fmi.master.thesis.beans.ProfileBean类型上找不到_Jsf_Jsf 2_Primefaces_El - Fatal编程技术网

Jsf javax.el.PropertyNotFoundException:Property';选择用户';在bg.fmi.master.thesis.beans.ProfileBean类型上找不到

Jsf javax.el.PropertyNotFoundException:Property';选择用户';在bg.fmi.master.thesis.beans.ProfileBean类型上找不到,jsf,jsf-2,primefaces,el,Jsf,Jsf 2,Primefaces,El,你知道为什么我的应用程序会抛出这个异常吗: 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="#{profil

你知道为什么我的应用程序会抛出这个异常吗:

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>

....

提前谢谢

我根据您的示例代码制作了一个简单的项目

<h:form>
    <p:commandButton id="submit" value="Save changes" actionListener="#{profileBean.editUser()}" >
       <f:setPropertyActionListener target="#{profileBean.selectedUser}" value="#{user}" />
    </p:commandButton>
</h:form>


没有上述错误。你的问题来自其他地方。删除不必要的位并尝试隔离问题。您可以更改属性的名称,并查看错误是否反映了新名称。确保没有其他同名的bean。

代码看起来没问题。您很可能没有运行您认为正在运行的代码。也就是说,您的环境似乎支持EL 2.2。为什么不仅仅是
action=“#{profileBean.editUser(user)}”
而不是这个监听器混乱?它再次抛出异常:由javax.el.MethodNotFoundException:/myProfile.xhtml@73,53 action=“#{profileBean.editUser(user)}”:找不到方法:bg.fmi.master.desh.beans。ProfileBean@11e9862.editUser(bg.fmi.master.thesis.model.TUser)。我也编辑了我的方法。在你关于类似问题的帖子中,写的是可以使用f:attribute,我设法使它与此代码一起工作,但我仍然不清楚为什么它不能以上面描述的其他方式工作。您很可能没有运行您认为正在运行的代码。我如何理解我正在运行的确切内容?除了此之外,日志中还有其他错误吗?