我正在使用selectOneMenu
来显示一些图片和字符串,这些图片仅用于显示目的(即我在提交时与他们无关)我只想设置旁边的字符串图片,我将itemValue
的{{1}}设置为所需的字符串时出现冲突,当我这样做时,图像根本不显示,在一个单词中我只想提交值所选f:selectItems
中的字符串,不使用转换器:
JSF代码:
selectItem
Skin.Java
<p:selectOneMenu id="SkinChooser" value="#{personBean.ObjectDTO.personDescription.skin}"
panelStyle="width:150px" effect="fade" var="s"
style="width:160px" converter="#{personBean.converter}">
<f:selectItem itemLabel="Select One" itemValue="" />
<f:selectItems value="#{missedPersonBean.selectedSkins}"
var="skin" itemLabel="#{skin.skinType}" itemValue="#{skin}" />
<p:column>
<p:graphicImage value="/resources/images/skin/#{s.skinPhoto}"
width="40" height="50" />
</p:column>
<p:column>
#{s.skinType}
</p:column>
</p:selectOneMenu>
personBean.Java
public class Skin {
String skinPhoto;
String skinType;
public Skin() {
}
public Skin(String photo, String type) {
this.skinPhoto = photo;
this.skinType = type;
}
public String getSkinPhoto() {
return skinPhoto;
}
public void setSkinPhoto(String skinPhoto) {
this.skinPhoto = skinPhoto;
}
public String getSkinType() {
return skinType;
}
public void setSkinType(String skinType) {
this.skinType = skinType;
}
}