ViewScope Problem

Splash Forums PrettyFaces Users ViewScope Problem

Tagged: 

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

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

    Ryaryu
    Participant

    Hi,

    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?

    Regards,
    Ryaryu.

    #26075

    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?

    Thanks!
    ~Lincoln

    #26076

    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”?

    #26077

    Ryaryu
    Participant

    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.

    Regards,
    Ryaryu.

    • This reply was modified 2 years, 4 months ago by  Ryaryu.
    #26079

    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)

You must be logged in to reply to this topic.

Comments are closed.