Objects can be passed through request and through session. (regarding javaEE). Interested in when and what objects are best kept in session?
- let's say, you can not trust the data from the request, but the data from the session, in general, you can. Typically, the session put the user data. - Alex Kapustin
|
1 answer
Something I think that storing data in a session is very safe. Well, any objects can be stored in the session. But mostly store user data (username and role, or something there that you need).
Well, and more. There are such situations that it is very convenient to store some objects in a session (for example, an action from several steps), here you also keep them in a session.
- What about session size? Load on the server? - Viacheslav
- Well, I think that sometimes it’s better to save something for a short time in a session than to send it back and forth (client-server). Well, if the objects are VERY large in size, then this is another story (for example, save in a temporary file and keep the path to the file in session). But the user data - a trifle of memory. - Anton Mukhin
|