How to redirect with params in JSF2?
When I enter the page I want to rediect to another page with params (f:view开发者_Python百科Param). How to do it?
Add includeViewParams=true
parameter to the outcome. JSF will then include the view params.
Update as per the comments you seem to want to change the request/response inside the view side. This is not guaranteed to work. The view is part of the response. Once the response is committed, there is a point of no return. You cannot change the request/response to another destination.
You want to handle this in the controller instead. If those requests originate from a JSF action, then you should do the controlling job there. Just let it return the desired outcome. Or if those requests originate from external links/bookmarks/etc, then you should do the controlling job in a Filter
class.
精彩评论