Uploaded image for project: 'MyFaces Core'
  1. MyFaces Core
  2. MYFACES-3656

ViewScoped bean fails when SERIALIZE_STATE_IN_SESSION is set to true

    XMLWordPrintableJSON

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Not A Problem
    • Affects Version/s: 2.0.15
    • Fix Version/s: None
    • Component/s: JSR-314
    • Labels:
      None
    • Environment:
      WebSphere V8 and Tomcat 2.0.27

      Description

      My beans are defined as follows:

      <managed-bean>
      <managed-bean-name>appManagerBean</managed-bean-name>
      <managed-bean-class>com.ibm.ws.jsf.beans.AppManagerBean</managed-bean-class>
      <managed-bean-scope>application</managed-bean-scope>
      </managed-bean>

      <managed-bean>
      <managed-bean-name>emailBean</managed-bean-name>
      <managed-bean-class>com.ibm.ws.jsf.beans.EmailBean</managed-bean-class>
      <managed-bean-scope>session</managed-bean-scope>
      </managed-bean>
      <managed-bean>
      <managed-bean-name>viewScopedBean</managed-bean-name>
      <managed-bean-class>com.ibm.ws.jsf.beans.ViewScopedManagedBean</managed-bean-class>
      <managed-bean-scope>view</managed-bean-scope>

      <managed-property>
      <property-name>emailBean</property-name>
      <value>#

      {emailBean}

      </value>
      </managed-property>
      <managed-property>
      <property-name>appManagerBean</property-name>
      <value>#

      {appManagerBean}

      </value>
      </managed-property>

      </managed-bean>

      I've provided an application that reproduces this issue. To reproduce follow these steps:

      1) install application
      2) drive a request into the following URL <host>:<port>/<context-root>/ViewScopeTest1.jsf
      3) leave the email field empty
      4) press the submit button.
      5) you should be taken to the error page
      6) the following text should appear in the textArea but it does not "Invalid Email: Email can Not be empty"

      The second test "ViewScopeTest2.jsf" is similar it does not contain the binding attribute and just references a value from the ViewScoped bean and the problem can again be reproduced.

      It seems as though the AppManager errorMessage field is null but it has not been reset. I would think that the application scoped bean would still be accessible even though the view scoped bean is out of scope.

      If you set the SERIALIZE_STATE_IN_SESSION to false and redeploy the application then everything works as expected, which seems odd to me but if you un-comment this from the web.xml you'll see we get the text on the error page as expected.

      I've been working to debug this issue and can't seem to figure out where the problem is in the MyFaces code. I tested the same application on WAS and Tomcat to ensure that it was not something specific to a server. It seems as though this is a implementation issue.

      Any help that folks can provide would be greatly appreciated!!

        Attachments

        1. ViewScopeProblemMyFaces.war
          12 kB
          Paul Nicolucci

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              paul.nicolucci Paul Nicolucci
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Time Tracking

                Estimated:
                Original Estimate - 24h
                24h
                Remaining:
                Remaining Estimate - 24h
                24h
                Logged:
                Time Spent - Not Specified
                Not Specified