0

我尝试将 Permissions pojo 类中的角色 ID 值显示到数据表中

这是我的问题,它显示了原始值的哈希值

我的豆类是:


        <f:facet name="header">
                Role Details

                </f:facet>

        <p:column headerText="Roleid" sortBy="#{ps.roleid}">



        <p:selectOneMenu id="role_id" value="#{ps.roleid}" >

            <f:selectItems value="#{one.p}" var="vv" itemLabel="#{vv}"
                itemValue="#{vv}" />

        </p:selectOneMenu>
        </p:column>

我的 pojo 课是:


one.java
private String roleid;

private String object_type;

private int object_id;

private int below;

private int high;

private boolean self;

private boolean exclude;

public String getRoleid() {

    return roleid;
}

public void setRoleid(String roleid) {

    this.roleid = roleid;
}
public String getObject_type() {

    return object_type;
}
public void setObject_type(String object_type) {

    this.object_type = object_type;
}
public int getObject_id() {

    return object_id;
}
public void setObject_id(int object_id) {

    this.object_id = object_id;
}

public int getBelow() {

    return below;
}
public void setBelow(int below) {

    this.below = below;
}
public int getHigh() {

    return high;
}
public void setHigh(int high) {

    this.high = high;
}
public boolean isSelf() {

    return self;
}
public void setSelf(boolean self) {

    this.self = self;
}
public boolean isExclude() {

    return exclude;
}
public void setExclude(boolean exclude) {

    this.exclude = exclude;
}

}
4

1 回答 1

3

如果您想将roleid属性显示为项目标签,那么只需相应地编写代码?现在,您正在打印整个对象(隐式显示其toString()值)而不是属性。

代替

itemLabel="#{vv}"

经过

itemLabel="#{vv.roleid}"

顺便说一下,“哈希码格式”只是该方法的默认结果,如果您的自定义类中没有,则将使用Object#toString()方法。@Override public String toString() { ... }

于 2013-07-12T15:39:01.533 回答