This week's giveaway is in the Spring forum.
We're giving away four copies of Learn Spring Security (video course) and have Eugen Paraschiv on-line!
See this thread for details.
Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

ViewExpire exception with @ViewScoped

 
Marco Noronha
Ranch Hand
Posts: 50
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 Lysenko
    Ranch Hand
    Posts: 511
    1
    Eclipse IDE Java
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    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
     
    Marco Noronha
    Ranch Hand
    Posts: 50
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    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
    Pie
    Posts: 17989
    47
    Android Eclipse IDE Linux
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    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.
     
    Marco Noronha
    Ranch Hand
    Posts: 50
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
    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?


     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic