0
를 업데이트모든 대화 상자가 나는 XHTML 페이지에이 대화 상자가 후원 콩
<p:dialog width="400" id="dialog1" header="Download" widgetVar="dialog1">
<h:outputText value="Field1"/>
<h:inputText value="#{backingBean.field1}"/>
<br/>
<h:outputText value="Field2"/>
<h:inputText value="#{backingBean.field2}"/>
<br/>
<p:commandButton value="Download" ajax="false" onsuccess="PF('diaglog1').hide();">
<p:fileDownload value="#{backingBean.file}"/>
</p:commandButton>
</p:dialog>
<p:dialog width="400" id="dialog2" header="Send" widgetVar="dialog2">
<h:outputText value="Field1"/>
<p:inputText value="#{backingBean.field1}"/>
<br/>
<h:outputText value="Field2"/>
<h:inputText value="#{backingBean.field2}">
<p:ajax update="somePanel"/>
</h:inputText>
<br/>
<h:outputText value="Recipient"/>
<h:panelGroup id="somePanel">
<p:selectOneMenu style="width: 100%;" var="recipient">
<f:selectItems value="#{backingBean.someList}"/>
</p:selectOneMenu>
</h:panelGroup>
<br/>
<p:commandButton value="Send" actionListener="#{backingBean.sendSomething}" onsuccess="PF('dialog2').hide();">
<f:attribute name="item" value="#{recipient}"/>
</p:commandButton>
</p:dialog>
그들은 서로 다른 기능을 가지고 있지만 같은 페이지에 같은 백업 콩을 사용합니다. 한 번에 하나의 대화 상자 만 나타날 수 있습니다. 문제는 첫 번째 대화 상자에 값을 입력하고 '다운로드'를 누르면 백킹 빈의 field1과 field2를 원하는 값으로 업데이트하지만 두 번째 대화 상자에서도 해당 값으로 업데이트됩니다. 첫번째 파일이 잘못된 파일을 다운로드하게합니다. 두 번째 대화 상자를 제거하면 첫 번째 대화 상자가 올바르게 작동합니다.
어떻게 두 번째 대화 상자에서 값을 업데이트하지 못하게합니까?
JSF로 들어가기 전에 기본 HTML을 배우는 것이 좋습니다. 감사합니다. – BalusC
. 그럴거야. –