You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Jakob Korherr (JIRA)" <de...@myfaces.apache.org> on 2010/07/08 23:48:52 UTC

[jira] Commented: (MYFACES-2792) Redirect with include-view-params in faces-config.xml

    [ https://issues.apache.org/jira/browse/MYFACES-2792?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12886510#action_12886510 ] 

Jakob Korherr commented on MYFACES-2792:
----------------------------------------

This should work now.

The problem was that ViewHandlerImpl.getViewParameterList() directly used the Map from the NavigationCase to add the view parameters. This means that all <f:viewParam/> are added as static (!!!) params to the NavigationCase and thus they were not updated on any following request.

Because of the fact that this is very tricky, I added some comments and two test cases to prevent us from falling into this trap again.

> Redirect with include-view-params in faces-config.xml
> -----------------------------------------------------
>
>                 Key: MYFACES-2792
>                 URL: https://issues.apache.org/jira/browse/MYFACES-2792
>             Project: MyFaces Core
>          Issue Type: Bug
>            Reporter: Gurkan Erdogdu
>            Assignee: Jakob Korherr
>             Fix For: 2.0.1-SNAPSHOT
>
>
> I have a bean 
> @ManagedBean(name="blog")
> @SessionScoped
> public class Blog {
> 	private String content;
> 	
> 	private static AtomicInteger id = new AtomicInteger(0);
> 	
> 	private String idm;
> 	public String addBlog(){
> 		this.idm = Integer.toString(id.incrementAndGet());
> 		return "view?faces-redirect=true&amp;includeViewParams=true";
> 	}
> }
> This is result view
> <h:body>
> 	
> 	<f:view>
> 		<f:metadata>
> 			<f:viewParam name="id" value="#{blog.idm}"></f:viewParam>
> 		</f:metadata>
> 	</f:view>
> 	
> 	<h:outputText value="#{blog.content}"></h:outputText>
> 	
> </h:body>
> This works! Changed to following and adding faces-config.xml
> 	public String addBlog(){
> 		this.idm = Integer.toString(id.incrementAndGet());
> 		return "ok";
> 	}
>     <navigation-rule>
>     	
>     	<navigation-case>
>     		<from-action>#{blog.addBlog}</from-action>
>     		<from-outcome>ok</from-outcome>
>     		<to-view-id>/view.xhtml</to-view-id>
>     		<redirect include-view-params="true"/>
>     	</navigation-case>
>     	
>     </navigation-rule>
> Not working! 
> What can be the problem? (I think doing some wrong actions!)

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.