looks interesting, what happens, if you have to EL based params ?

like 

<to-view-id>viewObject.jsp?test=#{param.test}&foo=#{param.foo}</to-view-id>

.Matthias

On Wed, 2006-02-15 at 16:32 -0500, Costa Basil wrote:
> One thing though, the implementation below blows up for normal view
> ids so I replaced it with the following code:
> 
> String targetViewId = navigationCase.getToViewId();
> if (targetViewId.indexOf("#{") != -1)
> {
>   ValueBinding vb =
> facesContext.getApplication().createValueBinding(navigationCase.getToViewId());
>   if (vb != null)
>      targetViewId = (String) vb.getValue(facesContext);
> }
> String redirectPath = viewHandler.getActionURL(facesContext,
> targetViewId);
> 
> Costa Basil <[EMAIL PROTECTED]> wrote:
>         Hi,
>         
>         This is a solution to an issue that some people complained
>         about and that is how to preserve request objects or other
>         objects when you do a redirect.
>         
>         It is actually possible to specify JSF EL expressions in the
>         to-view-id view. Example:
>         
>         In faces-config.xml I have:
>         
>         <navigation-case>
>           <from-outcome>goViewObject</from-outcome>
>           <to-view-id>viewObject.jsp?test=#{param.test}</to-view-id>
>           <redirect />
>         </navigation-case>
>         
>         
>         In a test page I created I have:
>         
>           <h:commandLink id="cmdLink" action="goViewObject" value="Go
>         To View Object">
>              <f:param name="test" value="xyz"/>
>           </h:commandLink>
>         
>         When I click on the link myfaces will redirect me to:
>         viewObject.jsp?test=xyz.
>          
>         
>         In order to do this I had to make a slight change to the
>         navigation handler
>         (org.apache.myfaces.application.NavigationHandlerImpl) 
>         that comes with MyFaces:
>         
>         I added the following lines:
>         
>             ValueBinding vb =
>         
> facesContext.getApplication().createValueBinding(navigationCase.getToViewId());
>             String targetViewId = vb != null ?
>         (String)vb.getValue(facesC ontext) :
>         navigationCase.getToViewId();
>             String redirectPath =
>         viewHandler.getActionURL(facesContext, targetViewId);
>         
>         to replace line 128 in
>         org.apache.myfaces.application.NavigationHandlerImpl (myfaces
>         1.1.1):
>         
>         line 128: String redirectPath =
>         viewHandler.getActionURL(facesContext,
>         navigationCase.getToViewId()); 
>         
>         
>         This way you can specify a JSF EL expression that would
>         dynamically compute the viewId or a portion of the viewId. You
>         could use this to save an object under a temporary key in the
>         session scope, and then pass this key to the next page (you
>         are redirecting to) which would use it to retrieve the object
>         from the session scope (and remove it).
>         
>         I think the ability to specify JSF EL expressions in the
>         to-view-id elements should be part of the standard.
>         
>         Any thoughts? 
>         
>         The other alternative to this would be to perform the
>         redirection "manually" in the action method (the parameters
>         would have to be added manually).
>         
>         
>         ______________________________________________________________
>         Find your next car at Yahoo! Canada Autos
> 
> 
> 
> 
> ______________________________________________________________________
> Find your next car at Yahoo! Canada Autos

Reply via email to