primefaces 5未从UI控件更新的支持bean值

时间:2015-09-27 16:14:49

标签: jsf-2 primefaces

我有一个简单的输入表单,它接受来自用户的数据,并在p:commandButton

的点击操作中将数据存储在DB中

表格看起来像这样

form.xhtml:

<div align="center" style="width: 80%">
            <p:panelGrid columns="1">
                <p:accordionPanel>

                    <p:tab title="#{msg['truck.tab.general']}">
                        <h:form><h:panelGrid columns="3">
                                <p:outputLabel value="*#{msg['truck.form.code']}"></p:outputLabel>
                                <p:inputText id="inputTruckCode" required="true"
                                    requiredMessage="Must exist"
                                    value="#{trucksBean.currentTruck.code}"></p:inputText>
                                <p:message for="inputTruckCode" showSummary="true"></p:message>
<!-- rest of the form -->
</h:form>
</p:tab>
</p:accordionPanel>
<p:commandButton action="#{trucksBean.insertTruck}"
                        value="Insert Truck"></p:commandButton>
                </p:panelGrid>
            </div>

支持bean代码:

@ManagedBean
@ViewScoped
public class TrucksBean {
private TruckFullInformation currentTruck;
public String insertTruck() {
        //the values inside currentTruck member variable are NULLs

        return null;
}

代码有什么问题?为什么点击commandButton并不会影响/更新&#34; currentTruck&#34;变量?

提前感谢;

0 个答案:

没有答案