Using redirect element & wild card

Ads
 

Using redirect element & wild card

is an optional element which can be used to specify that the response is generated by the new view using redirect response rather than rendering the response as the current request.

is an optional element which can be used to specify that the response is generated by the new view using redirect response rather than rendering the response as the current request.

Using redirect element & wild card

        

<redirect/> is an optional element which can be used to specify that the response is generated by the new view using redirect response rather than rendering the response as the current request. If we don't specify this element then the address bar shows the current page address even the response is generated by other page.

Specify navigation rule like below:

<navigation-rule>
   <from-view-id>/page/*</from-view-id>
   <navigation-case>
   <from-outcome>login</from-outcome>
   <to-view-id>/login.jsp</to-view-id>
   <redirect/>
   </navigation-case> 
</navigation-rule>

  • This navigation rule is defined for every jsf page of view id like "/page/*". Here * represents all the jsp pages in the page directory.
  • redirect element is used to show the new page url to the address bar.

 

Clicking the button redirects you to the login.jsp page as shown below: You can see the new page address at the address bar.

Download code for all examples

Ads

Ads