I have a problem in my Java EE project about refreshing of jsp pages. Every time a Servlet modifies the database in my project the changes do not appear in jsp pages. They appear only after the logout of the user.
Is there a method to make a refresh of the session after changes in the database MySQL? (I use the server JBoss).
Don’t store the from the DB retrieved data in the session scope. Store it in the request scope. This way the enduser will get most recent data on every HTTP request.
If you worry about performance, then look for another solution than abusing the HTTP session as some kind of an inefficient and unmanagable cache. For example, a DB connection pool in order to connect with the DB in 1ms instead of 200~500ms, or a Java based 2nd level DB cache such as Terracotta and Ehcache in order to have a sane and managable shared cache instead of inefficiently duplicating the very same data for all users in different HTTP sessions as you’re doing now.
This all is easier if you’re using JPA instead of “plain old” JDBC.