在XPage

时间:2017-12-01 16:47:54

标签: java binding xpages serverside-javascript

我正在尝试将inputField绑定到bean,但是我在webbrowser中得到以下错误

Error getting property 'Name' from bean of type com.app.PersonModel

面-配置

<?xml version="1.0" encoding="UTF-8"?>
<faces-config>
  <managed-bean>
    <managed-bean-name>person</managed-bean-name>
    <managed-bean-class>com.app.PersonModel</managed-bean-class>
    <managed-bean-scope>session</managed-bean-scope>
  </managed-bean>
 </faces-config> 

XPage

<?xml version="1.0" encoding="UTF-8"?>
<xp:view xmlns:xp="http://www.ibm.com/xsp/core">

    <xp:inputText id="Name" value="#{person.Name}"></xp:inputText>

</xp:view>

Java Bean

package com.app;
import java.io.Serializable;

public class PersonModel implements Serializable {

    private static final long serialVersionUID = 1L;

    private String Name;
    public PersonModel(){
    }

    public String getName() {
        return Name;
    }
    public void setName(String name) {
        Name = name;
    }

}

我错过了什么?

感谢

托马斯

1 个答案:

答案 0 :(得分:3)

从person.Name更改为person.name。因此,当您在XPage上引用name属性时,请执行此操作:

<xp:inputText id="Name" value="#{person.name}"></xp:inputText>