It's not a secret anymore!
The moose likes JSF and the fly likes Request Scoped Managed bean Confusion? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "Request Scoped Managed bean Confusion?" Watch "Request Scoped Managed bean Confusion?" New topic

Request Scoped Managed bean Confusion?

Prash Singh
Ranch Hand

Joined: Aug 23, 2009
Posts: 103

Dear All,

I am new to jsf application development and
I am really confused at some thing which I figured out.

the situation is , I am having a managed bean which is in request scope.
The jsp which is using that bean has a command button rendered attribute set to false by default.
On some value change event I change that attribute value to true.
But even now when the button is visible, the action method bounded to the bean does not execute and my whole bean gets refreshed. (Constructor gets called( expected)).

In other case if I make the render attribute of the button to true by default , then the button works fine , no problem at all.

Please clarify me on this behaviour of jsf.

Thanks & Regards
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17417

Request scope is almost totally useless in JSF because JSF re-requests the same page (postback) and each request creates a new copy of the request-scope beans.

If you are using JSF2, consider View Scope. For JSF 1, you need Session Scope.

An IDE is no substitute for an Intelligent Developer.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: Request Scoped Managed bean Confusion?
jQuery in Action, 3rd edition