Announcement Announcement Module
Collapse
No announcement yet.
Do the formBackingObject ought be called when click the submit button? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Do the formBackingObject ought be called when click the submit button?

    I thought the formBackingObject method of the SimpleFormController were only called right before popping up a form. I have a request parameter passed to the method and retrieving data based on the parameter. All things are going right until I click the submit button. An error occurs due to an invalid data.

    From the log file, the method is called second time when I click the submit button. Since the request parameter doesn't presented, an application logic error occurs.

    Does the fromBackingObject method called twice during the process of a form submission?

  • #2
    Unless you set sessionFrom to "true", fromBackingObject will be called upon submit.

    Comment


    • #3
      Originally posted by saturn
      Unless you set sessionFrom to "true", fromBackingObject will be called upon submit.
      You're right. It is stated in the petclient sample applicaiton. I ignored this detail.

      Thanks.

      Comment


      • #4
        BTW, I can't see any reasons not keeping the form in the session and building another copy of the form right before the submission.

        Any reasons?

        Comment


        • #5
          I am not sure. Maybe as a general rule you should not put too many objects into http session and if you do not need to, for example, load the object from the database in the formBackingObject (which is a heavy process and you'd better use session form), you do not really need sessionForm. For example, if all you need a is new instance of a command object (you do not even have to override the formBackingObject method).
          This is just my thoughts.

          Comment

          Working...
          X