myfaces-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Apache Wiki <wikidi...@apache.org>
Subject [Myfaces Wiki] Update of "Custom Navigation Handler" by Guy Bashan
Date Thu, 09 Mar 2006 15:30:14 GMT
Dear Wiki user,

You have subscribed to a wiki page or wiki category on "Myfaces Wiki" for change notification.

The following page has been changed by Guy Bashan:
http://wiki.apache.org/myfaces/Custom_Navigation_Handler

------------------------------------------------------------------------------
   2. The values in the second method are not passed when using redirection.
  
  For these reasons (And also for the reason of solving complex dynamic navigation issues),
assuming redirection is the preferable way of navigating between pages, one should consider
using a custom Navigation Handler adding the following capabilities:
- 1. Custom dynamic redirection to any page: This simply allows to return an action result
which will cause the Navigation Handler to directly redirect to a page. For example, in order
to redirect to a url:
+  1. Custom dynamic redirection to any page: This simply allows to return an action result
which will cause the Navigation Handler to directly redirect to a page. For example, in order
to redirect to a url:
  
  function String saveAction()
  {
@@ -31, +31 @@

  
  Pay attention, that in order to directly redirect to a specific page the prefix: "redirect:"
was addedd. Also page attention to the fact that only the relative path is used.
  
- 2. Dynamic Url parameters passing.
+  2. Dynamic Url parameters passing: This allows passing parameters between pages even when
using redirection method. For exmaple, in order to navigate from a pages name: view.jsp to
a page named: edit.jsp, with the parameter: objectId, the following thing can be done in navigation
rule code:
  
+   <navigation-rule>
+     <from-view-id>/view.jsp</from-view-id>
+     <navigation-case>
+       <from-outcome>edit</from-outcome>
+       <to-view-id>/view.jsp?objectId=#{view.objectId}</to-view-id>
+       <redirect />
+     </navigation-case>
+   </navigation-rule>
+ 
+ In view.jsp file the command link looks like:
+ 
+ <h:commandLink value="Edit" action="edit" />
+ 

Mime
View raw message