我尝试将Permissions pojo类中的roleid值显示到数据表
中这里我的问题是它显示了原始值的哈希值
我的bean类是:
<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;
}
}
答案 0 :(得分:3)
如果要将roleid
属性显示为项目标签,那么只需相应地编写代码?现在你打印整个对象(隐式显示其toString()
值)而不是属性。
替换
itemLabel="#{vv}"
通过
itemLabel="#{vv.roleid}"
“哈希码格式”只是the Object#toString()
method的默认结果,如果您的自定义类中没有@Override public String toString() { ... }
,则会使用该结果。