Reputation: 1883
I have a question about RequestScoped
ManagedBean
:
It seems like the RequestScoped
ManagedBean
is created every time we change something in the view, indeed, if we change value of <p:selectOneMenu>
, for example, method declared as @PostConstruct
is called.
I think this will slow the application.
Can some explain more this issue ?
Upvotes: 1
Views: 70
Reputation: 13556
It seems like the RequestScoped ManagedBean is created every time we change something in the view
RequestScoped
ManagedBean will be created for every request made. If changing something in the view is going to make a new request, e.g. ajax request, then the bean will be created and its method annotated with @PostConstruct
will get every time bean is created
I think this will slow the application
What kind of operation are you performing in that PostConstruct annotated method? What is it that you need everytime a request is created? If you could avoid that, then there is no need to write a PostConstruct
Upvotes: 2