Hello, I have read that is good coding when I create HttpSession, automaticly through HttpSessionBindingListiner to fill session.Attribute with data from Database, but for example, I put data "JSmith".. that there already here, but something is wrong here those setting attribute - Netbeans told me that he canot find variable session?
p.s. and I have that User class only with getters and setters
Please help me so I can go on.. with everything else
I have read it that sesson scope isnt thread-safe, so why wouldnt I in the bindingListener insted session.setAttribute("user",u) put request.setAttribute("user",u), beacause I need that data from the database as long as user is logged, and I dont wont that bindingListener replace data in ("user",u) with new data for new user.
When I need to use syncronized? Maybe here in BindingListiner, like:
And second, I need database connection for HttpBindingListener (and for bound and for unbound), can I do that two times (for each function)?