Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>EDIT #2: Note that this answer is no longer correct. See <a href="https://stackoverflow.com/a/9331400/294657">@doanduyhai's answer</a> below.</p> <p>EDIT: Please note that this is for Spring 2.5 and may, but does not necessarily ensure that the same is for Spring 3.x. Double check the docs!</p> <p>This is along the lines of what @Gandalf said.</p> <p>Form controllers model a form request lifespan, from initial viewing of the form through form submission. After the form is submitted, the form controller's job is done, and it will remove the command object from the session.</p> <p>So, to keep the command object in the session between form workflows you will need to manage the session manually. After a clean POST, the object is removed from session.</p> <p>In short, I believe the setComplete() method is just good practice but is not necessarily required.</p> <p><strong>EDIT</strong>: I just looked in my Spring book to confirm this. I'll quote it:</p> <blockquote> <p>When @SessionAttribute is not used, a new command object will be created on each request, even when rendering the form again due to binding errors. If this annotation is enabled, the command object will be stored in the session for subsequent uses, <strong>until the form completes successfully. Then this command object will be cleared from the session.</strong> This is usually used when the command object is a persistent object that needs to be identical across different requests for tracking changes.</p> </blockquote> <p>Essentially that's what I was saying above. It stores it in the session until you either A) call setComplete() or B) the controller successfully completes a POST.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload