ICEfaces
  1. ICEfaces
  2. ICE-5639

ViewScoped call @PostConstruct method on a partial submit

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Cannot Reproduce
    • Affects Version/s: 2.0-Alpha2
    • Fix Version/s: 2.0-Beta1, 2.0.0
    • Component/s: ICE-Components
    • Labels:
      None
    • Environment:
      JBoss 6, Windows XP

      Description

      I have a ViewScoped backing bean that has a partial submit on screen component the @PostConstruct method is called when the partial submit is perform; I don't believe that this functionality is correct.

        Activity

        Simon Fryer created issue -
        Ken Fyten made changes -
        Field Original Value New Value
        Salesforce Case []
        Assignee Deryk Sinotte [ deryk.sinotte ]
        Deryk Sinotte made changes -
        Salesforce Case []
        Fix Version/s 2.0-Beta [ 10231 ]
        Hide
        Deryk Sinotte added a comment -

        Marking as can't reproduce.

        I ran the Compat version of the Component Showcase that we have as it uses the 1.8 component suite with the ICEfaces 2 Alpha 3 libraries. The Text Entry example has components on the page that use partial submit. For example:

        <ice:inputText id="TxtName"
        size="30"
        maxlength="30"
        valueChangeListener="#

        {textFields.effectChangeListener}

        "
        value="#

        {textFields.name}

        "
        partialSubmit="true"
        required="true"
        >

        These are backed by a view-scoped bean that I added some logging to:

        @ManagedBean(name = "textFields")
        @ViewScoped
        public class TextFieldsBean extends BaseBean {
        /**

        • The different kinds of text input fields.
          */
          private String name;
          private String password;
          private String comments;

        public TextFieldsBean()

        { System.out.println("TextFieldsBean.TextFieldsBean: constructed " + this); }

        @PostConstruct
        public void logPostConstruct()

        { System.out.println("TextFieldsBean.logPostConstruct: called for " + this); }

        After building, redeploying, and running the example, I only see a single set of log statements for that view:

        [#|2010-06-07T14:59:17.317-0700|INFO|glassfishv3.0|javax.enterprise.system.std.com.sun.enterprise.v3.services.impl|_ThreadID=27;_ThreadName=Thread-1;|TextFieldsBean.TextFieldsBean: constructed org.icefaces.application.showcase.view.bean.examples.component.textEntry.TextFieldsBean@1d39e225|#]

        [#|2010-06-07T14:59:17.317-0700|INFO|glassfishv3.0|javax.enterprise.system.std.com.sun.enterprise.v3.services.impl|_ThreadID=27;_ThreadName=Thread-1;|TextFieldsBean.logPostConstruct: called for org.icefaces.application.showcase.view.bean.examples.component.textEntry.TextFieldsBean@1d39e225|#]

        So perhaps this was solved in the Alpha 3 release. If it's still an issue, we'll need a more specific test case and additional details to reproduce.

        Show
        Deryk Sinotte added a comment - Marking as can't reproduce. I ran the Compat version of the Component Showcase that we have as it uses the 1.8 component suite with the ICEfaces 2 Alpha 3 libraries. The Text Entry example has components on the page that use partial submit. For example: <ice:inputText id="TxtName" size="30" maxlength="30" valueChangeListener="# {textFields.effectChangeListener} " value="# {textFields.name} " partialSubmit="true" required="true" > These are backed by a view-scoped bean that I added some logging to: @ManagedBean(name = "textFields") @ViewScoped public class TextFieldsBean extends BaseBean { /** The different kinds of text input fields. */ private String name; private String password; private String comments; public TextFieldsBean() { System.out.println("TextFieldsBean.TextFieldsBean: constructed " + this); } @PostConstruct public void logPostConstruct() { System.out.println("TextFieldsBean.logPostConstruct: called for " + this); } After building, redeploying, and running the example, I only see a single set of log statements for that view: [#|2010-06-07T14:59:17.317-0700|INFO|glassfishv3.0|javax.enterprise.system.std.com.sun.enterprise.v3.services.impl|_ThreadID=27;_ThreadName=Thread-1;|TextFieldsBean.TextFieldsBean: constructed org.icefaces.application.showcase.view.bean.examples.component.textEntry.TextFieldsBean@1d39e225|#] [#|2010-06-07T14:59:17.317-0700|INFO|glassfishv3.0|javax.enterprise.system.std.com.sun.enterprise.v3.services.impl|_ThreadID=27;_ThreadName=Thread-1;|TextFieldsBean.logPostConstruct: called for org.icefaces.application.showcase.view.bean.examples.component.textEntry.TextFieldsBean@1d39e225|#] So perhaps this was solved in the Alpha 3 release. If it's still an issue, we'll need a more specific test case and additional details to reproduce.
        Deryk Sinotte made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Cannot Reproduce [ 5 ]
        Hide
        Simon Fryer added a comment - - edited

        Hi, I have replicated the problem with the following code. There are three files below an xhtml, a java and a js file.
        As you can see I call the iceSubmitPartial function manually.

        The postconstruct method is called if a selectInputDate is placed inside a tooltip and poup calendar button is pressed.
        I've also found if you put a displaylistener on a panelTooltip the postconstruct method is called.

        test.xhtml
        [
        <ice:form id="frmIndex1">
        <ice:panelGrid>
        <ice:panelGroup id="divIntelText" onmouseup="setSelectedText();" style="width: 630px; height: 350px; overflow: auto; border-style: solid; border-width: 1px; border-color: #D9D9D9;">
        <f:verbatim>
        #

        {testBean.bodyText}

        </f:verbatim>
        </ice:panelGroup>
        <ice:inputText id="txtSelected"
        value="#

        {testBean.selectedText}

        "
        onchange="iceSubmitPartial( form, this, event);"
        style="display: none" />
        </ice:panelGrid>
        </ice:form>
        ]

        TestBean.java
        [
        package com.abmsoftware.backingbean;

        import javax.annotation.PostConstruct;
        import javax.faces.bean.ManagedBean;
        import javax.faces.bean.ViewScoped;

        @ManagedBean
        @ViewScoped
        public class TestBean
        {
        private String selectedText;

        private String bodyText = "Hello there";

        @PostConstruct
        public void init()

        { System.out.println("Init"); }

        public String getBodyText()

        { return bodyText; }

        public void setBodyText(String bodyText)
        {
        }

        public void setSelectedText(String selectedText)

        { System.out.println("Selected text is: " + selectedText); }

        public String getSelectedText()

        { return selectedText; }

        }

        ]

        intel.js
        [
        var selectedText;

        // Sets the selected text in the server code.
        function setSelectedText()
        {
        var txt = '';

        if(window.getSelection)

        { txt = window.getSelection(); }

        else if(document.getSelection)

        { txt = document.getSelection(); }

        else if(document.selection)

        { txt = document.selection.createRange().text; }

        txt = new String(txt);

        if(txt.length > 0)

        { selectedText = document.getElementById("frmIndex1:txtSelected"); selectedText.value = txt; selectedText.onchange(); }

        }
        ]

        Show
        Simon Fryer added a comment - - edited Hi, I have replicated the problem with the following code. There are three files below an xhtml, a java and a js file. As you can see I call the iceSubmitPartial function manually. The postconstruct method is called if a selectInputDate is placed inside a tooltip and poup calendar button is pressed. I've also found if you put a displaylistener on a panelTooltip the postconstruct method is called. test.xhtml [ <ice:form id="frmIndex1"> <ice:panelGrid> <ice:panelGroup id="divIntelText" onmouseup="setSelectedText();" style="width: 630px; height: 350px; overflow: auto; border-style: solid; border-width: 1px; border-color: #D9D9D9;"> <f:verbatim> # {testBean.bodyText} </f:verbatim> </ice:panelGroup> <ice:inputText id="txtSelected" value="# {testBean.selectedText} " onchange="iceSubmitPartial( form, this, event);" style="display: none" /> </ice:panelGrid> </ice:form> ] TestBean.java [ package com.abmsoftware.backingbean; import javax.annotation.PostConstruct; import javax.faces.bean.ManagedBean; import javax.faces.bean.ViewScoped; @ManagedBean @ViewScoped public class TestBean { private String selectedText; private String bodyText = "Hello there"; @PostConstruct public void init() { System.out.println("Init"); } public String getBodyText() { return bodyText; } public void setBodyText(String bodyText) { } public void setSelectedText(String selectedText) { System.out.println("Selected text is: " + selectedText); } public String getSelectedText() { return selectedText; } } ] intel.js [ var selectedText; // Sets the selected text in the server code. function setSelectedText() { var txt = ''; if(window.getSelection) { txt = window.getSelection(); } else if(document.getSelection) { txt = document.getSelection(); } else if(document.selection) { txt = document.selection.createRange().text; } txt = new String(txt); if(txt.length > 0) { selectedText = document.getElementById("frmIndex1:txtSelected"); selectedText.value = txt; selectedText.onchange(); } } ]
        Ken Fyten made changes -
        Fix Version/s 2.0.0 [ 10230 ]
        Ken Fyten made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Deryk Sinotte
            Reporter:
            Simon Fryer
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: