File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSF and the fly likes ViewExpire exception with @ViewScoped Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » JSF
Bookmark "ViewExpire exception with @ViewScoped" Watch "ViewExpire exception with @ViewScoped" New topic
Author

ViewExpire exception with @ViewScoped

Marco Noronha
Ranch Hand

Joined: Oct 30, 2012
Posts: 50
Guys,

I was trying to make my APP work with Spring and JSF. And make spring take care of the ManagedBean lifecycle.
But as the cool guys from this forum said, I decided to leave that to JSF and use Spring only for other type of beans.

But now, my viewScoped bean gets its viewExpired and nothing works on it. If I change the ManagedBean to "SessionScoped" than every thing
works like a charm.

NOTE: I tested in both JSF implementations! Both throws the same exception!

So, I´ll show you guys the config files:
  • web
  • faces-config






  • Ok... Now I´ll show you the "header" of my ManagedBean.


    Just some explanation.. I Have a abstract class representing all methods and stuff.. But, you guys already noticed that! lol
    Since I need a default constructor ... I use postConstruct annotation to set the content of the parent class.

    Well, I don´t think I need to show you guys the view (xhtml). The first motive is that I created alot of composite components,
    so, the 'dirty' code are all encapsulated.

    If I need to show, please ask!
    Thanks
    Volodymyr Levytskyi
    Ranch Hand

    Joined: Mar 29, 2012
    Posts: 505
        
        1

    Hello!

    To have my sessio be expired after 30 minutes of doing nothing I have in my web.xml

    To redirect user to index.xhtml when ViewExpiredException occurs I have this


    True person is moral, false is right!
    Marco Noronha
    Ranch Hand

    Joined: Oct 30, 2012
    Posts: 50
    Volodymyr Levytskyi wrote:Hello!

    To have my sessio be expired after 30 minutes of doing nothing I have in my web.xml

    To redirect user to index.xhtml when ViewExpiredException occurs I have this


    thanks for the reply, but that´s not it!
    Tim Holloway
    Saloon Keeper

    Joined: Jun 25, 2001
    Posts: 16012
        
      19

    I think I mentioned this already, but a JSF backing bean isn't a Controller, It's a Model.

    Your use of a DynaForm does tend to muddy a lot of things, though, and it's one reason I haven't been able to give more useful answers.

    Views should expire any faster in View Scope than in Session Scope. For one thing, I'm virtually certain that View Scope is simply a Session Scope that cleans up after itself.

    My suspicion is that you're referencing the View after the View has been initially departed. I would be unsurprised to learn that you've bound the Dynaform to that view and are attempting to employ it after its context has been destroyed by the View Scope clean-up services.

    These are just guesses, however. I'm afraid that when I get hit with large code samples this early in the morning, my response is to fall back in my chair and drool.


    Customer surveys are for companies who didn't pay proper attention to begin with.
    Marco Noronha
    Ranch Hand

    Joined: Oct 30, 2012
    Posts: 50
    lol lol!

    I fixed the problem!!
    I can´t believe it was just this:



    and ViewScoped started to work again!
    Buttttttttt !!

    I found a person that made a framework that was the 2 scopes I needed!
    It is "AccessScope".. The managedBean keeps alive if the next page has references to it.
    And its working great!! I talked to the person who did it . He said it is a "spring bean" he created
    using orchestra conversation scope.. Something like that. I cant give more information because I lack! lol

    But it works great! I´m really surprised!
    http://code.google.com/p/lindbergframework/

    that is the framework .. the module is called "myview"!

    Can you give me an opinion about it?


     
    I agree. Here's the link: http://aspose.com/file-tools
     
    subject: ViewExpire exception with @ViewScoped