此内容没有您所选择的语言版本。

9.2.3. Page nodes and transitions


Each <page> node represents a state where the system is waiting for user input:
<page name="displayGuess" view-id="/numberGuess.jsp"> 
  <redirect/> 
  <transition name="guess" to="evaluateGuess"> 
    <action expression="#{numberGuess.guess}" /> 
  </transition> 
</page>
Copy to Clipboard Toggle word wrap
The view-id is the JSF view ID. The <redirect/> element has the same effect as <redirect/> in a JSF navigation rule — that is, a post-then-redirect behavior, to overcome problems with the browser's refresh button. (Note that Seam propagates conversation contexts across these browser redirects, so Seam does not require a Ruby on Rails-style flash construct.)
The transition name is the name of a JSF outcome triggered by clicking a command button or command link in numberGuess.jsp.
<h:commandButton type="submit" value="Guess" action="guess"/>

Copy to Clipboard Toggle word wrap
When clicking this button triggers the transition, jBPM activates the transition action by calling the guess() method of the numberGuess component. The syntax used for specifying actions in the jPDL is a familiar JSF EL expression, and the transition handler is a method of a Seam component in the current Seam contexts. Thus, we have the same event model for jBPM events as we have for JSF events. This is one of the guiding principles of Seam.
In the case of a null outcome (for example, a command button with no action defined), Seam signals the transition with no name (if one exists), or simply redisplay the page if all transitions are named. Therefore we could simplify this button and our pageflow like so:
<h:commandButton type="submit" value="Guess"/>
Copy to Clipboard Toggle word wrap
This would fire the following un-named transition:
<page name="displayGuess" view-id="/numberGuess.jsp">
  <redirect/>
  <transition to="evaluateGuess">
    <action expression="#{numberGuess.guess}" />
  </transition>
</page>
Copy to Clipboard Toggle word wrap
The button could also call an action method, in which case the action outcome determines the transition to be made:
<h:commandButton type="submit" value="Guess" 
   action="#{numberGuess.guess}"/>
Copy to Clipboard Toggle word wrap
<page name="displayGuess" view-id="/numberGuess.jsp">
  <transition name="correctGuess" to="win"/>
  <transition name="incorrectGuess" to="evaluateGuess"/>
</page>
Copy to Clipboard Toggle word wrap
However, this style is considered inferior, since it shifts responsibility for flow control out of the pageflow definition and back into other components. It is much better to centralize this concern in the pageflow itself.
返回顶部
Red Hat logoGithubredditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。 了解我们当前的更新.

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

Theme

© 2025 Red Hat