Meaningless Drivel is fun!*
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
Author

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: 15957
    
  19

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.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Request Scoped Managed bean Confusion?
 
Similar Threads
Making component rendered using <p:commnadButton> via ajax
h:inputText readonly="true" not updating managed bean values
My JSF Portlet Tutorial
Back end validation problem .
JSF drop down problem