[jboss-user] [JBoss Seam] - To parenthesis or not to parenthesis, that is thy question.

bytor99999 do-not-reply at jboss.com
Fri Aug 24 00:16:35 EDT 2007


OK, that subject is just foolish, but anyway, I always seem to get myself stuck behind a problem of my pages.xml navigation not working. 

Now, I have gotten smart after the tenth time this has happened to me to first try to either add or remove the parenthesis in the pages.xml for a <from-action> element.

But, I have an idea, now it might not completely work, because what if the action takes parameters, then my solution just won't help. But here it is anyway.

Right now to determine the Navigation it gets all the possible Navigations from a Page stored as a map, and the key is the action Expression, which might or might not have parenthesis and the String passed to navigate might or might not have parenthesis. So I propose the following code for the Pages class.


  |          
  | public boolean navigate(FacesContext context, String actionExpression, String actionOutcomeValue)
  |    {
  |       String viewId = getViewId(context);
  |       if (viewId!=null)
  |       {
  |          List<Page> stack = getPageStack(viewId);
  |          for (int i=stack.size()-1; i>=0; i--)
  |          {
  |             Page page = stack.get(i);
  |             Map<String, Navigation> navigations = page.getNavigations();
  |             Navigation navigation = navigations.get(actionExpression);
  |             if (navigation==null)
  |             {
  |                navigation = navigations.get(actionExpression+"()");
  |                if (navigation==null)
  |                {
  |                   navigation = page.getDefaultNavigation();
  |                }
  |             }            
  | 

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

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



More information about the jboss-user mailing list