因爲兩天我面對PrimeFaces 3.5 selectOneMenu對象的奇怪問題。 我在這個體系結構中使用EJB項目中的JPA + EJB + JAX-WS,並使用Web項目中的JAX-WS服務創建客戶機。然後將Web服務客戶端封裝到ManagedBean中,以便與我的PrimeFaces接口綁定。 我ManagedBean如下:primefaces 3.5 selectonemenu不顯示數據
import java.util.List;
import javax.ejb.Stateless;
import javax.inject.Named;
import tg.moov.imereport.service.DownStream;
import tg.moov.imereport.service.DownStreamWSService;
@Named
@Stateless
public class DownStreamMBean {
private DownStreamWSService service;
public DownStreamMBean() {
service = new DownStreamWSService();
}
public List<DownStream> getDownStreamsService() {
return service.getDownStreamWSPort().getDownStreams();
}
}
和selectOneMenu用於代碼如下:
<h:form>
<p:selectOneMenu value="#{downStreamTotalMBean.ds.IDDownStream}">
<f:selectItems value="#{downStreamMBean.downStreamsService}" var="item"
itemValue="#{item.IDDownStream}" itemLabel="#{item.nom}"/>
</p:selectOneMenu>
</h:form>
這裏是下游類:
package tg.moov.imereport.service;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlType;
/**
* <p>Java class for downStream complex type.
*
* <p>The following schema fragment specifies the expected content contained within this class.
*
* <pre>
* <complexType name="downStream">
* <complexContent>
* <restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
* <sequence>
* <element name="IDDownStream" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="IPAddress" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="login" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="nom" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="password" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* <element name="path" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
* </sequence>
* </restriction>
* </complexContent>
* </complexType>
* </pre>
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "downStream", propOrder = {
"idDownStream",
"ipAddress",
"login",
"nom",
"password",
"path"
})
public class DownStream {
@XmlElement(name = "IDDownStream")
protected String idDownStream;
@XmlElement(name = "IPAddress")
protected String ipAddress;
protected String login;
protected String nom;
protected String password;
protected String path;
/**
* Gets the value of the idDownStream property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getIDDownStream() {
return idDownStream;
}
/**
* Sets the value of the idDownStream property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setIDDownStream(String value) {
this.idDownStream = value;
}
/**
* Gets the value of the ipAddress property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getIPAddress() {
return ipAddress;
}
/**
* Sets the value of the ipAddress property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setIPAddress(String value) {
this.ipAddress = value;
}
/**
* Gets the value of the login property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getLogin() {
return login;
}
/**
* Sets the value of the login property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setLogin(String value) {
this.login = value;
}
/**
* Gets the value of the nom property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getNom() {
return nom;
}
/**
* Sets the value of the nom property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setNom(String value) {
this.nom = value;
}
/**
* Gets the value of the password property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPassword() {
return password;
}
/**
* Sets the value of the password property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPassword(String value) {
this.password = value;
}
/**
* Gets the value of the path property.
*
* @return
* possible object is
* {@link String }
*
*/
public String getPath() {
return path;
}
/**
* Sets the value of the path property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setPath(String value) {
this.path = value;
}
}
Web服務正常工作和顯示數據,但selectOneMenu不顯示任何內容。 請有人幫助我。如果需要,我可以提供更多信息。
問候。
你可以張貼tg.moov。 imereport.service.DownStream?我想知道什麼toString實現看起來像那個類(如果它已被覆蓋) – 2013-04-24 12:41:04
我剛剛用DownStream JPA類更新了我的第一篇文章。提前致謝 ! – 2013-04-24 12:51:41
對不起,它是來自tg.moov.imereport.service的DownStream。 – 2013-04-24 12:57:34