简体   繁体   English

grails webflow错误

[英]grails webflow error

i have this grails webflow 我有这个grails webflow

def currencyDescriptionFlow = {
    start {
        action {
            flow.messageCommand = new MessageCommand()
            flow.currencyId = params.id
            flow.languageList = Language.findAll([sort: 'codeDescription', order: 'asc'])
        }
        on('success').to('description')
    }

    description{
        action{
            flow.DescriptionMessageList = Message.findAllByKey(flow.currencyId + '_Currency')
        }
        on('add').to('addSubmit')
        on('finish').to('currencyShow')
    }

    addSubmit{
        action {
            MessageCommand cmd ->
            flow.messageCommand = cmd
            if (!flow.messageCommand.validate()){
                error()
            }
        }
        on('error').to('description')
        on('success').to('description')
    }

    saveMessage{
        action{
            def str =  flow.currencyId + '_Currency'
            messageSevice.descriptionMultiLanguage(str, params.description, params.Language)
        }
        on('error').to('description')
        on('success').to('description')
    }

    currencyShow{
        redirect(controller:'currency', action: "show", id: flow.currencyId)
    }
}

when i click the link to redirect to this page, ann error occurs 当我单击链接重定向到此页面时,发生错误

Error 500: No transition was matched on the event(s) signaled by the [1] action(s) 
that executed in this action state 'description' of flow 'message/currencyDescription';
transitions must be defined to handle action result outcomes -- possible flow 
configuration error? Note: the eventIds signaled were: 'array<String>
['success']', while the supported set of transitional criteria for this action 
state is 'array<TransitionCriteria>[add, finish]'

Servlet: grails

URI: /adm-appserver-manager/grails/message/currencyDescription.dispatch

Exception Message: No transition was matched on the event(s) signaled by the [1] 
action(s) that executed in this action state 'description' of flow 'message/currencyDescription'; 
transitions must be defined to handle action result outcomes -- possible flow
configuration error? Note: the eventIds signaled were: 'array<String>
['success']', while the supported set of transitional criteria for this action state 
is 'array<TransitionCriteria>[add, finish]' 

Caused by: No transition was matched on the event(s) signaled by the [1] action(s) 
that executed in this action state 'description' of flow 'message/currencyDescription'; 
transitions must be defined to handle action result outcomes -- possible flow 
configuration error? Note: the eventIds signaled were: 'array<String>['success']',     
while the supported set of transitional criteria for this action state is 
'array<TransitionCriteria>[add, finish]' 

Class: Unknown 

At Line: [-1] 

Code Snippet:

Note: 注意:

where language is a table in the database
MessageCommand is command object
messageService is a service
descriptionMultiLanguage method in message service for saving message


i try this way of writing code in another action and controoler and it works without any error.


by debugging this code i found the error on ( 
on('add').to('addSubmit')
on('finish').to('currencyShow')
)
when i remove these 2 lines , no problem found
def currencyDescriptionFlow = {
    start {
        action {
            flow.messageCommand = new MessageCommand()
            flow.currencyId = params.id
            flow.languageList = Language.findAll([sort: 'codeDescription', order: 'asc'])
            flow.DescriptionMessageList = Message.findAllByKey(flow.currencyId + '_Currency')
        }
        on('success').to('description')
    }

    description{
        on('add').to('addSubmit')
        on('finish').to('currencyShow')
    }

    addSubmit{
        action {
            MessageCommand cmd ->
            flow.messageCommand = cmd
            if (!flow.messageCommand.validate()){
                error()
            }
            flow.message = null
        }
        on('error').to('description')
        on('success').to('saveMessage')
    }

    saveMessage{
        action{
            Message messageInstance = new Message(language:flow.messageCommand.language,value:flow.messageCommand.value,key:flow.currencyId + '_Currency')
            if (!messageInstance.save(flush:true)){
                flow.message = "${message(code: 'error.adding.description')}"
                error()
            }
            flow.DescriptionMessageList = Message.findAllByKey(flow.currencyId + '_Currency')
        }
        on('error').to('description')
        on('success').to('description')
    }

    currencyShow{
        redirect(controller:'currency', action: "show", id: flow.currencyId)
    }
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM