ViewScope Problem

Splash Forums PrettyFaces Users ViewScope Problem


This topic contains 4 replies, has 3 voices, and was last updated by  Lincoln Baxter III 7 years, 9 months ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
  • #26074



    I have a strange problem. I use Spring View Scope (a custom one), that works well in my entire page. The system design allows me to use pages without parameters, so everything works great with pretty faces.
    But one of the pages must receive parameters from the URL, to which I followed the docs and passed the parameters using a Bean and an Action. Great. The problem is that every AJAX call on the page calls the action. That could be workaround’ed, but all the attributes in the Bean are erased when this happens, the URL parameters included, but that should not happen since I didn’t redirect the page.
    I used the parameter onPostback=”false” on the Action, and it worked, no calls are made to the Action method besides the original request. But it also disables every AJAX request on the page. I really can’t find a way out of this.
    Can someone help me?



    Hey there, this sounds like a tricky problem. Any chance you could post a small sample (maven if possbile) application that reproduces this problem so we can take a look? What server are you running on?



    It is expected behavior that the action is called on each AJAX request if you don’t set onPostback=false. If you use the view scope, setting onPostback=false is typically required.

    So the problem is that setting onPostback=false breaks you AJAX postbacks. What do you mean with “disables every AJAX request on the page”?



    Hi, thanks for the answers.

    I cannot send a sample of the project, Lincoln, since we use some intern libs that can be the cause of the problem (the custom view, as an example).

    Christian, when I set onPostback=false no AJAX works. I made a workaroung getting the URL parameters from the request, so I don’t suffer from NullPointerExceptions anymore, but it stills have to initialize all data again (some of it is heavy DAO operations) at every AJAX request.

    It seems that my Bean is working in Request Scope, although I have it annotated with View Scope.
    Maybe the problem is the scope + pretty parameters, we use the custom view scope coded in this website.


    • This reply was modified 7 years, 9 months ago by  Ryaryu.

    Yeah, it sounds like perhaps the scope is the issue. It’s possible the scope is not being re-built correctly. That may be the underlying issue here.

Viewing 5 posts - 1 through 5 (of 5 total)

The forum ‘PrettyFaces Users’ is closed to new topics and replies.

Comments are closed.