I want to enable or disable component based on navigation rule. For example, I want to enable a component when I traverse from a particular page otherwise it should be in disable开发者_如何转开发d state.
Probably the easiest way if you're using JSF 2.0, is to put a parameter in your navigation rule. If you use an f:viewParam
on the target page that you bind to some bean, you can just check whether the property to which you bound the view parameter is empty or not.
If your navigation rule does not cause a redirect, you can also put some marker in request scope. The initial rendering of the target page will happen within the same request and easily pick this up. In that case, you do have to store it in some appropriate place (e.g. view scope in JSF 2) to retain the info on postbacks.
精彩评论