Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jsf-2/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jsf 2 使用弹出面板创建新数据对象失败_Jsf 2_Dialog_Richfaces - Fatal编程技术网

Jsf 2 使用弹出面板创建新数据对象失败

Jsf 2 使用弹出面板创建新数据对象失败,jsf-2,dialog,richfaces,Jsf 2,Dialog,Richfaces,这里我再次谈到一个JSF问题,这次更多的是关于richfaces(4.2.1最终版,JSF2)。我有一个数据表,想添加新项目。这里有旅程对象的列表,每个属性都有getter和setter。表创建得很好(列表中已经有一些项)。现在我单击“添加新项目”按钮: 当我单击按钮时,调用了方法doCreateJourney,但是currentJourney是空的。它是创建后的默认旅程对象。没有调用setter,请在inputfields上执行提示 我检查了两次名称,所有需要的对象都有getter和sette

这里我再次谈到一个JSF问题,这次更多的是关于richfaces(4.2.1最终版,JSF2)。我有一个数据表,想添加新项目。这里有
旅程
对象的列表,每个属性都有getter和setter。表创建得很好(列表中已经有一些项)。现在我单击“添加新项目”按钮:

当我单击按钮时,调用了方法
doCreateJourney
,但是
currentJourney
是空的。它是创建后的默认
旅程
对象。没有调用setter,请在inputfields上执行提示

我检查了两次名称,所有需要的对象都有getter和setter。我试图改变范围,但没有效果。对象是相同的,在我创建的prepare方法
旅程(id=151)
和save方法中仍然是
旅程(id=151)


这是怎么回事?制作一些对话框来创建和编辑数据对象不会这么困难。感谢您的聆听和帮助

为了正确提交数据,您需要将输入和commandbutton都包装在一个表单中


... 你的popupPanel的内容

关于,

嗯,我在这里查找类似的编辑对话框:popupPanel也在同一个对话框中。但是您的想法是正确的,创建两个表单并在第一个表单之外包含对话框是正确的。这是有效的!非常感谢。
<a4j:commandButton ajax="true" value="Neue Fahrt hinzufügen" 
   actionListener="'{editorBean.prepareCreateJourney}" render="createJourneyPopupForm"  
   oncomplete="#{rich:component('createJourneyPopup')}.show()" />
<rich:popupPanel id="createJourneyPopup" modal="true">
    <h:panelGrid id="createJourneyPopupForm" columns="3">
        <h:outputLabel for="currentId" value="ID" />
        <h:inputText id="currentId"
            value="#{editorBean.currentJourney.journeyNumber}" />
        <rich:message for="currentId" />
        [...and more...]
    </h:panelGrid>

    <a4j:commandButton value="Save"
      execute="currentId currentTrainType operator">
        <f:ajax event="click" listener="#{editorBean.doCreateJourney}"
            render=":vmsEditorForm:resultTable" />
        <rich:componentControl target="createJourneyPopup" operation="hide" />
    </a4j:commandButton>
    <a4j:commandButton value="Abbrechen"
        onclick="#{rich:component('createJourneyPopup')}.hide();" />
</rich:popupPanel>