File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Request Scoped Managed bean Confusion?

 
Prash Singh
Ranch Hand
Posts: 103
jQuery Netbeans IDE Notepad
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 17616
39
Android Eclipse IDE Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic