Announcement Announcement Module
Collapse
No announcement yet.
Action state errors Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Action state errors

    I've searched for a solution to the following problem, but was suprised to find nothing. Upon submission of my form, I bindAndValidate and everything passes. I then transition to an action-state where I interact with the business layer via a MultiAction. If my business layer transaction fails, I need to redisplay the original form with an error message (much like if validation of a field fails).

    I'd like to use an Errors object in my MultiAction and add the message key. Should I instead move the method to my FormAction bean to perform the business transaction and then use the getFormErrors()? I like the idea of centralizing my business transactions in the MultiAction though.

    Any help would be greatly appreciated!
    Last edited by jerkoch; Jul 22nd, 2006, 12:08 AM.

  • #2
    I would recommend *not* keeping your business logic inside of a SWF artifact...try and keep it as light as possible, in the same way controllers just delegate to a middle tier "service" layer, so should the Action.

    Having said all of that, the FormAction is actually a MultiAction, so there is no reason you cannot add your own methods onto that.

    Comment


    • #3
      Right, that's what I've gathered pouring over this forum. My MultiAction *is* very thin. It just groups a bunch of methods that make a single call to the service tier, then inspect the response and returns 1 of 4 possible event ids representing the direction the flow should branch. One of those directions is back to the original form with an error.

      I guess moving the method into my FormAction is the way to go. Thanks for the feedback.

      Comment


      • #4
        If you do need to access the form object or the form errors check out http://static.springframework.org/sp...tAccessor.html.

        To me, a FormAction is responsible for manipulating a form object therefore code which plays around with it should belong in the same FormAction....but that is just me I am not saying anything which *uses* that form object should be there, only lifecycle management stuff.

        Comment

        Working...
        X