获取SelectOneMenu的选定值

时间:2014-09-04 13:04:52

标签: jsf primefaces selectonemenu

我有一个JSF selectOneMenu,我填充<SelectItem>,我希望在数据库中获取所选项的值。我怎么能这样做?

这是我的Java代码:

private Date dateCreation;

public void saveTicket() {
    ticket.setIdTicket( idTicket );   
    ticket.setDateCreation( dateCreation );
    ticket.setIdClient1( maValeur );
    DaoImp daoImp = new DaoImp();
    daoImp.add( ticket );
}

这是我的观看代码:

<h:outputLabel for="button" value="Date Creation :" style="font-size:15px; font-family:verdana" />
    <p:calendar id="button" pattern="dd.MM.yyyy HH:mm:ss" value="#{now}" maxdate="#{now}" style="font-size:15px; "/>
    <h:outputLabel value="Client :" style="font-size:15px; font-family:verdana" /></td>
    <p:selectOneMenu id="CombobxClient" value="#{ticketBean.maValeur}" style="width:210px; height:20px; font-size:10px; font-weight:1px;">
        <f:selectItems value="#{ticketBean.mesElements}" style="font-size:10px;">
        </f:selectItems>
     </p:selectOneMenu>

0 个答案:

没有答案