You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Avaneesh Arora <av...@gmail.com> on 2005/04/12 15:23:22 UTC

Navigation issues with MyFaces

I am using MyFaces 1.0.8:

I have the following example Navigation.jsp file:

<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://myfaces.apache.org/extensions" prefix="x"%>

<x:panelNavigation id="nav" styleClass="navigation"
	separatorClass="navseparator" itemClass="navitem"
	activeItemClass="navitem_active" openItemClass="navitem_open">
	<x:commandNavigation id="nav_home" value="Home" action="go_home" />
	<x:commandNavigation id="nav_topic1" value="Topic1">
		<x:commandNavigation id="nav_topic1_item1" value="ITEM1"
action="#{Page1.go_inv}">
			<f:param name="invType" value="Item1" />
		</x:commandNavigation>
		<x:commandNavigation id="nav_topic1_item2" value="ITEM2"
action="#{Page1.go_inv}">
			<f:param name="invType" value="Item2/>
		</x:commandNavigation>
	</x:commandNavigation>
	<x:commandNavigation id="nav_topic2" value="Topic2">
		<x:commandNavigation id="nav_topic2_item1" value="ITEM1"
action="#{Page1.go_pm}" >
			<f:param name="pmType" value="Item1" />
		</x:commandNavigation>
		<x:commandNavigation id="nav_topic2_item2" value="ITEM2"
action="#{Page1.go_pm}" >
			<f:param name="pmType" value="Item2" />
		</x:commandNavigation>	
	</x:commandNavigation>
</x:panelNavigation>


And this is my examples-config file:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD
JavaServer Faces Config 1.0//EN"
                              "http://java.sun.com/dtd/web-facesconfig_1_0.dtd">
<faces-config>
 <managed-bean>
  <managed-bean-name>Page1</managed-bean-name>
  <managed-bean-class>test.Page1</managed-bean-class>
  <managed-bean-scope>session</managed-bean-scope>
  <managed-property>
   <property-name>invType</property-name>
   <property-class>java.lang.String</property-class>
   <value/>
  </managed-property>
  <managed-property>
   <property-name>pmType</property-name>
   <property-class>java.lang.String</property-class>
   <value/>
  </managed-property>
 </managed-bean>
 <navigation-rule>
  <from-view-id>/home.jsp</from-view-id>
  <navigation-case>
   <from-outcome>go_inv</from-outcome>
   <to-view-id>/Inventory.jsp</to-view-id>
  </navigation-case>
  <navigation-case>
   <from-outcome>go_pm</from-outcome>
   <to-view-id>/Performance.jsp</to-view-id>     
  </navigation-case>
 </navigation-rule>
 <lifecycle/>
 <application>
  <locale-config/>
 </application>
 <factory/>
</faces-config>

The problem I am seeing is that when the home.jsp page first shows up, the view
gets stuck on whatever link I select first . If any of the sub menus under
go_inv link get selected, then Inventory.jsp page shows up. If I first select
any links under go_pm, then the Performance.jsp view shows up.
After that, clicking any other link does not change the JSP corresponding to
the selected menu item. The page just refreshes but the view does not change.

In my test.Page1 managed bean, the go_pm or go_inv return the correct
names as per
the navigation rules. And each menu item click does trigger the action and the
appropriate method gets called. However, the Jsp corresponding to the selection
does not change.

What is going wrong here?

Thanks,
Avaneesh Arora