I'm currently fiddling around with Spring AS, and I'm having an architectural question.
It seems so basic to me, and I don't know why I never really got to think of this before..
I'm making an application with a pretty big users-database behind it, to make all kinds of reports.
Let's take the next flow as an example:
- User logs on to my application
- User clicks a button that says "Create Report" (which obviously, well.... -- creates a new "Report")
- Application displays a form (called "ReportComponent"), and a ReportPresentationModel is created & linked to this, using DI.
- User starts to fill out form.
- User decides to log out of application before submitting the form
Now, the problem is that if a new user logs in without doing a page refresh in the browser first,
he will see the formwhich is half-ass filled out (in our example), because the state was never lost.
So I thought: instead of clearing all the filled out fields in the presentationmodel and the view,
it would be better that on a logout I would do somewhere "reportpresentationmodel.instance = null"
and on a new login, I would say "view = new ReportComponent".
-> ReportpresentationModel would be null, so the singleton implementation would create a new "instance",
resulting in no clearing issues, or data that gets persisted while it shouldn't.
So my questions are:
- does this sound like "the right way to do this" to you?
- if so: is there a way in Spring AS to clear a presentationModel (or make it multiton instead of singleton or something)
- if not: how do you tackle this usually? creating a new context (sounds dirty..)? Are there modules I should work with, ....?
I also had a look at this application:
Log in and make a new user, select "Boles, Matt" in the list, log out, and log back in.
You still see the same users, and "Boles, Matt" will still be selected.
To me this is just not the behaviour I expect...No?
Looking forward to hear your opinions on this!