Results 1 to 4 of 4

Thread: Action state errors

  1. #1
    Join Date
    Jul 2006
    Posts
    21

    Default 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 at 12:08 AM.

  2. #2
    Join Date
    Aug 2004
    Posts
    1,905

    Default

    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.
    Colin Yates
    SpringSource - http://www.springsource.com - Spring Training, Consulting, and Support - "From the Source"
    Please read http://www.springframework.org/documentation
    Co-Author of Expert Spring MVC + Web Flow.

  3. #3
    Join Date
    Jul 2006
    Posts
    21

    Default

    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.

  4. #4
    Join Date
    Aug 2004
    Posts
    1,905

    Default

    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.
    Colin Yates
    SpringSource - http://www.springsource.com - Spring Training, Consulting, and Support - "From the Source"
    Please read http://www.springframework.org/documentation
    Co-Author of Expert Spring MVC + Web Flow.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •