How can a servlet refresh automatically if some new data has entered the database?
You can use a client-side Refresh or Server Push -- see What is server push? How do I use it from a servlet?
You also have to figure out how to ask the database if something changed, on the servlet-side. You're on your own for that :-) See the JDBC FAQ for help. You probably have to spawn a thread that periodically does an SQL query.