[jboss-user] [JBoss Seam] - Re: Seam 2, pages.xml and pageflow

rlhr do-not-reply at jboss.com
Mon Jul 30 14:30:21 EDT 2007


So I'm still struggling with that issue. I created a small example based on the numberguess example that reproduce the problem (zip file available if needed).

I have the following classes:


  | @Name("user")
  | @Scope(ScopeType.CONVERSATION)
  | public class User implements Serializable {
  | 
  | 	private String pet;
  | 
  | 	public String getPet() {
  | 	  return pet;
  | 	}
  | 
  | 	public void setPet(String pet) {
  | 	  this.pet = pet;
  | 	}
  | }
  | 


  | @Name("navigation")
  | @Scope(ScopeType.CONVERSATION)
  | public class Navigation implements Serializable {
  | 
  | 	@In(required=true)
  | 	User user;
  | 
  | 	@Logger
  | 	private Log log;
  | 
  | 	public String animalOutcome(){
  | 		if (user == null){
  | 			return "Dog"; // Just to make sure we don't return null
  | 		}
  | 		log.info("********* Outcome: " + user.getPet());
  | 		return user.getPet();
  | 	}
  | 
  | 	public User getUser() {
  | 	  return user;
  | 	}
  | 
  | 	public void setUser(User user) {
  | 	  this.user = user;
  | 	}
  | }
  | 


  | @Name("animals")
  | public class AnimalList
  | {
  | 
  |    private List<String> animals;
  |    
  |    @Unwrap
  |    public List<String> unwrap()
  |    {
  |       if (animals == null)
  |       {
  |          animals = new ArrayList<String>();
  |          animals.add("Dog");
  |          animals.add("Cat");
  |          animals.add("Goldfish");
  |          animals.add("Rabbit");
  |          animals.add("Snake");
  |          animals.add("Parrot");
  |       }
  |       return animals;
  |    }
  | }
  | 

Pages.xhtml is defined as followed:


  | <pages xmlns="http://jboss.com/products/seam/pages"
  |        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  |        xsi:schemaLocation="http://jboss.com/products/seam/pages http://jboss.com/products/seam/pages-2.0.xsd">
  | 
  |    <page view-id="/pageOne.xhtml">
  |       <begin-conversation join="true" pageflow="navigation" />
  |    </page>
  | 
  | 	<page view-id="/animalPage.xhtml" action="#{navigation.animalOutcome}">
  | 		<navigation>
  | 		    <rule if-outcome="Dog">
  | 			<redirect view-id="/animal/dog.xhtml"/>
  | 		    </rule>
  | 		    <rule if-outcome="Cat">
  | 			<redirect view-id="/animal/cat.xhtml"/>
  | 		    </rule>
  | 		    <rule if-outcome="Goldfish">
  | 			<redirect view-id="/animal/goldfish.xhtml"/>
  | 		    </rule>
  | 		    <rule if-outcome="Rabbit">
  | 			<redirect view-id="/animal/rabbit.xhtml"/>
  | 		    </rule>
  | 		    <rule if-outcome="Snake">
  | 			<redirect view-id="/animal/snake.xhtml"/>
  | 		    </rule>
  | 		    <rule if-outcome="Parrot">
  | 			<redirect view-id="/animal/parrot.xhtml"/>
  | 		    </rule>
  | 		</navigation>
  | 	</page>
  |   
  | </pages>
  | 

The pageflow is defined as:


  | <pageflow-definition 
  | 	xmlns="http://jboss.com/products/seam/pageflow"
  | 	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  |     	xsi:schemaLocation="http://jboss.com/products/seam/pageflow http://jboss.com/products/seam/pageflow-2.0.xsd"
  | 	name="navigation">
  |    
  |    <start-page name="displayChoice" view-id="/pageOne.xhtml">
  |       <redirect/>
  |       <transition name="next" to="animalPage" />
  |    </start-page>
  | 
  |    <page name="animalPage" view-id="/animalPage.xhtml">
  |       <end-conversation/>
  |       <redirect/>
  |    </page>
  |    
  | </pageflow-definition>
  | 

And finally the pageOne.xhtml:


  | <html xmlns="http://www.w3.org/1999/xhtml"
  |       xmlns:c="http://java.sun.com/jstl/core"
  | 	  xmlns:ui="http://java.sun.com/jsf/facelets"
  | 	  xmlns:h="http://java.sun.com/jsf/html"
  | 	  xmlns:f="http://java.sun.com/jsf/core"
  |       	  xmlns:s="http://jboss.com/products/seam/taglib">
  | 
  |    <head>
  |       <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  |       <title>Test Navigation</title>
  |    </head>
  | 
  |    <body>
  |       <div id="container">
  | 	   <h3>Choose an animal</h3>
  | 	   <h:form>
  | 		<h:selectOneMenu value="#{user.pet}">
  | 			<s:selectItems value="#{animals}" var="animal" label="#{animal}" noSelectionLabel="Select your pet"/>
  | 		</h:selectOneMenu>
  | 
  | 		<h:commandButton value="Go To Pet Page" action="next" />
  | 	   </h:form>
  |       </div>
  |    </body>
  | </html>
  | 

When I select an animal, I get the following stacktrace:


  | INFO: Added Library from: jar:file:/C:/Jboss/jboss-4.2.0.GA/server/default/tmp/d
  | eploy/tmp50163navigation.ear-contents/navigation-exp.war/WEB-INF/lib/jsf-facelet
  | s.jar!/META-INF/jstl-core.taglib.xml
  | 13:23:07,046 INFO  [Navigation] ********* Outcome: Cat
  | 13:23:07,218 INFO  [Navigation] ********* Outcome: Cat
  | 13:23:07,281 INFO  [Navigation] ********* Outcome: Cat
  | 13:23:07,359 INFO  [Navigation] ********* Outcome: Cat
  | 13:23:07,437 INFO  [Navigation] ********* Outcome: Cat
  | 13:23:07,515 INFO  [Navigation] ********* Outcome: Cat
  | 13:23:07,609 INFO  [Navigation] ********* Outcome: Cat
  | 13:23:07,687 INFO  [Navigation] ********* Outcome: Cat
  | 13:23:07,781 INFO  [Navigation] ********* Outcome: Cat
  | 13:23:07,859 INFO  [Navigation] ********* Outcome: Cat
  | 

This is the stacktrace using firefox (FF detects the loop and stop the recursion). On IE, the loop never ends.

I tried to debug but I didn't really find where the problem lies. I also tried to change the pages.xml definition and played around quite bit.
If I move the outcome definition in faces-config.xml, I get the same problem. That problem occurs only with Seam 2 (Seam 1.2.2 works fine).

So as a conclusion, I'm stuck :)
Do I do anything wrong? Is that a bug?

If someone want to code, I can upload a zip of the files somewhere.

Thanks.

Richard

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4068844#4068844

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4068844



More information about the jboss-user mailing list