Refresh JSP After Servlet Changes in the Database

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.

Hello, buddy!稿源:Hello, buddy! (源链) | 关于 | 阅读提示

本站遵循[CC BY-NC-SA 4.0]。如您有版权、意见投诉等问题,请通过eMail联系我们处理。
酷辣虫 » 后端存储 » Refresh JSP After Servlet Changes in the Database

喜欢 (0)or分享给?

专业 x 专注 x 聚合 x 分享 CC BY-NC-SA 4.0

使用声明 | 英豪名录