Seam页面流示例NumberGuess未登陆到第二页

时间:2015-03-12 12:32:21

标签: seam jboss-seam page-flow jpdl

我试图运行简单的Seam PageFlow示例NumberGuss。我已经在Jboss Server上部署了它。当我访问该URL时,它会落在第一页上,但如果我点击该页面上提供的任何按钮,则表示"该页面未正确重定向"。在服务器日志中我找到了

SEVERE [javax.enterprise.resource.webcontainer.jsf.application] (default task-16) Error Rendering View[/debug.xhtml]: org.jboss.weld.context.NonexistentConversationException: WELD-000321: No conversation found to restore for id 1.

I'm using wildfly-8.1.0 and jboss-seam-2.3.1

Attaching pageflow.jpdl.xml and numberGuess.xhtml for reference. Please help me resolve the issue I'm facing.



<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:s="http://jboss.org/schema/seam/taglib">
  <h:head>
    <title>Guess a number...</title>
    <link href="niceforms.css" rel="stylesheet" type="text/css" />
    <script language="javascript" type="text/javascript" src="niceforms.js"><!-- --></script>
  </h:head>
  <body>
    <h1>Guess a number...</h1>
      <h:form id="NumberGuessMain" styleClass="niceform">

        <div>
        <h:messages id="messages" globalOnly="true"/>
        <h:outputText id="Higher"
                          value="Higher!" 
                      rendered="#{numberGuess.randomNumber gt numberGuess.currentGuess}"/>
        <h:outputText id="Lower"
                          value="Lower!" 
                      rendered="#{numberGuess.randomNumber lt numberGuess.currentGuess}"/>
        </div>

        <div>
        I'm thinking of a number between <h:outputText id="Smallest" value="#{numberGuess.smallest}"/> and
        <h:outputText id="Biggest" value="#{numberGuess.biggest}"/>. You have
        <h:outputText id="RemainingGuesses" value="#{numberGuess.remainingGuesses}"/> guesses.
        </div>

        <div>
        Your guess:
        <h:inputText id="inputGuess" value="#{numberGuess.currentGuess}" required="true" size="3" 
                 rendered="#{(numberGuess.biggest-numberGuess.smallest) gt 20}">
          <f:validateLongRange maximum="#{numberGuess.biggest}" 
                               minimum="#{numberGuess.smallest}"/>
        </h:inputText>

        <h:selectOneMenu id="selectGuessMenu" value="#{numberGuess.currentGuess}" required="true" rendered="#{numberGuess.selectMenuRendered}">
          <s:selectItems id="PossibilitiesMenuItems" value="#{numberGuess.possibilities}" var="i" label="#{i}"/>
        </h:selectOneMenu>

        <h:selectOneRadio id="selectGuessRadio" value="#{numberGuess.currentGuess}" required="true" rendered="#{numberGuess.radioButtonRendered}">
          <s:selectItems id="PossibilitiesRadioItems" value="#{numberGuess.possibilities}" var="i" label="#{i}"/>
        </h:selectOneRadio>

        <h:commandButton id="GuessButton" value="Guess" action="guess"/>
        <s:button id="CheatButton" value="Cheat" action="cheat"/>
        <s:button id="GiveUpButton" value="Give up" action="giveup"/>
        </div>

        <div>
        <h:message id="message" for="inputGuess" style="color: red"/>
        </div>

      </h:form>
  </body>
</html>
&#13;
<!-- 

   An example of pageflow in jPDL. This exemplifies the
   approach where action handlers are attached transitions
   and decision nodes, instead of view components. 
   An alternative approach would be to attach all action 
   handlers to view components, and let the jPDL define
   only the navigation rules.
   
-->

<pageflow-definition 
	xmlns="http://jboss.org/schema/seam/pageflow"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation=
	    "http://jboss.org/schema/seam/pageflow http://jboss.org/schema/seam/pageflow-2.3.xsd"
	name="numberGuess">
   
   <start-page name="displayGuess" view-id="/numberGuess.xhtml">
      <redirect/>
      <transition name="guess" to="evaluateGuess">
         <action expression="#{numberGuess.guess}"/>
      </transition>
      <transition name="giveup" to="giveup"/>
      <transition name="cheat" to="cheat"/>
   </start-page>
   
   <decision name="evaluateGuess" expression="#{numberGuess.correctGuess}">
      <transition name="true" to="win"/>
      <transition name="false" to="evaluateRemainingGuesses"/>
   </decision>
   
   <decision name="evaluateRemainingGuesses" expression="#{numberGuess.lastGuess}">
      <transition name="true" to="lose"/>
      <transition name="false" to="displayGuess"/>
   </decision>
   
   <page name="giveup" view-id="/giveup.xhtml">
      <redirect/>
      <transition name="yes" to="lose"/>
      <transition name="no" to="displayGuess"/>
   </page>
   
   <process-state name="cheat">
      <sub-process name="cheat"/>
      <transition to="displayGuess"/>
   </process-state>

   <page name="win" view-id="/win.xhtml">
      
      <redirect/>
	  <end-conversation/>
   </page>
   
   <page name="lose" view-id="/lose.xhtml">
      
      <redirect/>
	  <end-conversation/>
   </page>
   
</pageflow-definition>
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:0)

解决了问题.Weld正在扫描存档,这似乎会导致问题.Weld Docs说: 您只能通过将以下内容添加到应用程序的META-INF / jboss-all.xml文件中来为部署设置此项。 jboss-all.xml文件转到你的META-INF for ear archive,很可能转到WEB-INF for war archive

<jboss xmlns="urn:jboss:1.0">
<weld xmlns="urn:jboss:weld:1.0" require-bean-descriptor="true"/>
</jboss> 

它对我有用。