Uploaded image for project: 'Spring Web Flow'
  1. Spring Web Flow
  2. SWF-1502

Incorrectly filled form is blank after submit when ajax="false" on commandbutton

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Complete
    • Affects Version/s: 2.3.0
    • Fix Version/s: 2.3.1
    • Component/s: JSF
    • Labels:
      None

      Description

      Hi,

      From swf forum:

      I have problem which I can best describe on swf sample application 'booking-faces'.

      Simply:
      1. Add 'ajax="false"' attribute to 'proceed' button in 'enterBookingDetails.xhtml'
      2. Fill out form with some incorrect data (e.g. Credit Card Number: asdasd).
      3. Click proceed.
      4. Response is the same form with validation errors, but form is blank... other fields which were filled correcty have default values.

      The reason is:
      ajax="false" causes (of course) redirect... in validation failure case, redirect is to the same view
      so swf invokes method below which should return state to save 'so that should be available across the redirect', but for jsf 2+ it returns null...

      org.springframework.faces.webflow.JsfView#getUserEventState()

      	public Serializable getUserEventState() {
      		if (isLessThanJsf20()) {
      			// Set the temporary UIViewRoot state so that it will be available across the redirect
      			return new ViewRootHolder(getViewRoot());
      		} else {
      			// In JSF 2 the partial state saving algorithm attaches a system event listener to the UIViewRoot which
      			// holds on to a reference to the FacesContext instance. The FacesContext instance is released at end of
      			// each request. Hence, keeping the UIViewRoot across the redirect is not feasible.
      			// @see com.sun.faces.context.StateContext$AddRemoveListener
      			logger.debug("User event state requested but not saved.");
      			return null;
      		}
      	}
      

      Actually, the reason is out of date:
      http://java.net/jira/browse/JAVASERVERFACES-1604
      It was fixed on 2-jul-2010 (I checked it also in mojarra svn - rev. 8849 which hits mojarra 2.0.4)

      So it should be also fixed in spring-faces.

      Major because this is unacceptable in production use to have blank form after POST...

        Attachments

          Activity

            People

            Assignee:
            rstoya05-aop Rossen Stoyanchev
            Reporter:
            rjanas Radosław Janas
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: