2
Grails noob here ...Grails WebFlow 상태 이름
어떻게 Grails 웹 플로우 상태에서 상태 이름을 얻을 수 있습니까? Grails WebFlow와 jQueryMobile을 사용하여 모바일 앱을 프로토 타이핑하고 있습니다. 그것은 주로리스트로 구성된 모바일 앱이기 때문에, 나는 다시이 같은 스택을 사용하여 이벤트 관리 :이 작동
class myController {
def myFlow {
start {
action {
flow.states = []
[ ... ]
}
on("success").to "state0"
}
state0 {
on("back").to "home"
on("event") {
flow.states << "state0"
}.to "state1"
}
state1 {
on("back").to { flow.states.pop() }
on("event") {
flow.states << "state1"
}.to "state2"
}
state2 {
on("back").to { flow.states.pop() }
}
home {
redirect(...)
}
}
}
,하지만 난에 flow.states << "state#"
같은 라인에있는 하드 코딩 상태 이름 문자열을 대체하고 싶습니다 표현 방법이 있다면 표현할 수 있습니다.
편집 :이 작업을 수행 할 수없는 이유를 설명하는 답변을 수락합니다.
RequestContext 및/또는 FlowExecutionContext를 사용해 보셨습니까? 예 : FlowExecutionContext.currentState.id? – callie16
전화하세요. 나는이 코드가 작동 함을 발견했다 :'flow.states << flowExecution.activeSession.state.id'. 주석 대신 응답으로 공식화하려면 확실히 받아 들일 것입니다. – lambmj
고마워요, 할거야;) – callie16