user1765876
user1765876

Reputation:

Why there is no Page scope in JSF

My questions says it all.. We have different type of scopes in JSF but why not Page scope? Thank you

Upvotes: 1

Views: 1880

Answers (2)

McDowell
McDowell

Reputation: 108979

Page scope as defined in JavaServer Pages 2.2:

Objects with page scope are accessible only within the page where they are created. All references to such an object shall be released after the response is sent back to the client from the JSP page or the request is forwarded somewhere else. References to objects with page scope are stored in the pageContext object.

Page scope as defined by JSPs is not an appropriate scope to use in JSF. There is no reason for the view to be creating objects directly. If a managed bean were defined in page scope it could not be resolved by any page action as the JSP would not be invoked until the render response phase of the JSF request lifecycle.

In JSF, the JSP merely serves as the View Definition Language; it performs no business logic.

Upvotes: 2

Petr Mensik
Petr Mensik

Reputation: 27536

What should the page Page scope mean?In JSF 2.0 you have ViewScope which is used when you are triggering some actions on the same page and you want to hold your data during this process. If this is not enough for you, IceFaces offers you a custom WindowScope which extends ViewScope and it can survive page refresh.

Upvotes: 1

Related Questions