【发布时间】:2014-05-01 00:25:24
【问题描述】:
大家好,我有一个问题,我正在使用 selctOneMenu,在我选择其中一个替代方法后,服务器端的其他方法永远不会触发,我不知道为什么
这是我的 jsf 代码 sn-ps
....
...
<p:panel style="height:85px;">
<h:outputLabel
style="font: italic;font-family:serif;font-weight: lighter;font-size: x-large;">
Mode de Payement:
</h:outputLabel>
<p:selectOneMenu value="#{commandeActBeanc.modePayement}">
<f:selectItem itemLabel="--" itemValue="" />
<f:selectItems value="#{modePayementArtBean.modesPayementLista}"
var="mode" itemLabel="#{mode.intitule}" itemValue="#{mode}" />
</p:selectOneMenu>
</p:panel>
</h:panelGrid>
<br />
<p:contextMenu for="articles" widgetVar="cMenu">
<p:menuitem value="Edit Cell" icon="ui-icon-search"
onclick="PF('BCTable').showCellEditor();return false;" />
<p:menuitem value="Hide Menu" icon="ui-icon-close"
onclick="PF('cMenu').hide()" />
</p:contextMenu>
<p:dataTable id="articles" var="art" rendered="true"
paginator="true" rows="10" style="width:99%;padding-left:8px;"
value="#{commandeActBeanc.mediumArticleSuppModel}" editable="true"
editMode="cell" widgetVar="BCTable"
rowKey="#{art.idArtileBoncommande}"
selection="#{commandeActBeanc.selectedArticlesSupp}">
<f:facet name="header">
Commande n° #{commandeActBeanc.cmd.idBoncommande}
</f:facet>
<p:ajax event="cellEdit" listener="#{commandeActBeanc.onCellEdit}"
update=":form:messages,:@this,:form:totaleTtc,:form:totaleHt,:form:totaleTva" />
<p:column selectionMode="multiple" style="width:2%" />
<p:column headerText="code.Art" style="width:15%">
#{art.codeArticle}
</p:column>
<p:column headerText="Libelle.Art" style="width:15%">
#{art.referenceArticle}
</p:column>
<p:column headerText="P.U en TTC" style="width:15%">
#{art.prixUnitTtc}
</p:column>
<p:column headerText="Quantité" style="width:15%">
<p:cellEditor>
<f:facet name="output">
<h:outputText value="#{art.quantite}" />
</f:facet>
<f:facet name="input">
<p:inputText value="#{art.quantite}" style="width:96%"
label="Quantite" />
</f:facet>
</p:cellEditor>
</p:column>
这是我的豆子:
@Component("commandeActBeanc")
@SessionScoped
public class CommandeActionBean {
@Autowired
private transient ICommandeDao commandeDAO;
@Autowired
private transient IPcArticleBoncommandeDao articleCommandeDAO;
@Autowired
private transient IProduitDao articleDAO;
private Integer idBoncommande;
private Agent agent;
private ModePayement modePayement;
private String numero;
private Boolean isValide;
private Boolean isSolde;
private Boolean isImprime;
private Boolean isSaved;
private Date dte;
这是我的 ModPayemenActionBean
@Component("modePayementArtBean")
@SessionScoped
public class ModePayementActionBean {
@Autowired
IModePayementDao modePayementDao;
private String intitule;
private List<ModePayement> modesPayementLista= new ArrayList<ModePayement>();
/*-----------------------------------Setters et Getters--------------------------------*/
public IModePayementDao getModePayementDao() {
return modePayementDao;
}
public ModePayementActionBean() {
}
public List<ModePayement> getModesPayementLista() {
modesPayementLista= new ArrayList<ModePayement>();
modesPayementLista.addAll(getModePayementDao().findAll());
for (int i=0;i<modesPayementLista.size();i++){
System.out.println(modesPayementLista.get(i));
}
return modesPayementLista;
}
public void setModesPayementLista(List<ModePayement> modesPayementLista) {
this.modesPayementLista = modesPayementLista;
}
public void setModePayementDao(IModePayementDao modePayementDao) {
this.modePayementDao = modePayementDao;
}
public String getIntitule() {
return intitule;
}
public void setIntitule(String intitule) {
this.intitule = intitule;
}
}
【问题讨论】:
标签: java jsf jsf-2 primefaces