Jerry Jacob's Blog

Navigation while using Tiles with JSF

Posted in Java/ J2EE by jerlinworld on October 15, 2009

I would like to post a tip while using Tiles with JSF. I had to spend a few hours to fix the navigation issue that I experianced while coding my App.

I was using the body tile page for the ‘from-view-id’ element while coding the navigation rule. This is wrong and we should be using the actual page name.

Incorrect value for ‘from-view-id’

<navigation-rule>
		<from-view-id>/tilesContent/index_body.jsp</from-view-id>
		<navigation-case>
			<from-action>#{index.loginAction}</from-action>
			<from-outcome>success</from-outcome>
			<to-view-id>/login.jsp</to-view-id>
		</navigation-case>
	</navigation-rule>

Correct value for ‘from-view-id’

<navigation-rule>
		<from-view-id>/index.jsp</from-view-id>
		<navigation-case>
			<from-action>#{index.loginAction}</from-action>
			<from-outcome>success</from-outcome>
			<to-view-id>/login.jsp</to-view-id>
		</navigation-case>
	</navigation-rule>
Advertisements