0

I have a xhtml page, in which i'm trying to open a dialog and set/change some values. Page is normally backed by MemberInformationService, in this page's page.xml, i call a wire function to set some values into MemberLogHome's instance. Everything goes perfect. When i press the commandButton to open dialog, I can see that MemberLogHome's instance is setted correctly, ( I can see the values i set on the dialog) but at the same time, there is an unexpected createInstance call which later continues with a setInstance that makes MemberLogHome's instance values null. Because of this when i submit my dialog i get errors. I couldnt find what makes the unexpected call. Also this call is executed whenever i open a dialog. I'm using Seam 2.3 and primefaces 3.5

Classes are pretty big i'm writing just the parts i think relevant

Inside of Xhtml:

<p:menuitem value="#{messages.overallChange}"
                                onclick="dlg2.show()" />

<p:dialog header="#{messages.overallChange}" widgetVar="dlg2"
        modal="true" resizable="true" appendToBody="true">
<h:form>
<p:panelGrid columns="1">
                        <s:decorate template="layout/edit.xhtml">
                            <ui:define name="label">#{messages.memberId}</ui:define>
                            <p:inputText
                                value="#{memberLogHome.instance.memberByNewMemberId.id}" />
                        </s:decorate>
....
<h:commandButton value="#{messages.submit}"
                action="#{memberInformationService.saveOverallChange}"
                oncomplete="dlg2.hide();" />
</h:form>
</p:dialog>

Inside of MemberInformationService

@Name("memberInformationService")
@Scope(ScopeType.PAGE)
public class MemberInformationService {
@In(create = true)
MemberLogHome memberLogHome;
    ...
public void wire() {
...
fillMemberLog();
}
public void fillMemberLog(){

memberLogHome.clearInstance();
memberLogHome.setInstance(new MemberLog());

memberLogHome.getInstance().setBranchByNewBranchId(trustMemberHome.getInstance().getBranch());
...
}

1 Answer 1

0

If your public void wire() is called with an <action /> tag in your page.xml, make sure its on-postback attribute is set to false, otherwise it will be called again on any postback, including the form submit, executing the first two lines of fillMemberLog() and clearing the values in the instance.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.