My webapplication accesses a database both ways during a "session".
Servlets communicate with the db with helperclasses- static methods querying and executing updates. Each servlet may query the db multiple times and each doGet() or doPost() ends with closing the db-connection(conn.close()).
(I have NOT implemented a connectionpool). Each servlet implements SingleThreadModel and they share only one connectionobject. The application will not be heavily used by too many clients at a time, so I thought this would be an easy way to work around the problem(SingleThreadModel and no connectionpool). A timer also runs for a certain time to track inactivity and close the connection if inactivity is the case. This whole approach is mostly due to still learning
JDBC and
Java.
That's the background, here's the first question:
Does this approach seem reasonable???
And the last question Iv'e seemed to ask too many people:
With the application working as stated above, exactly what will happen at browser-closing???
(If beans would have been used, to my knowledge, that could be considered the end of a session?)
A discussion/answer to these topics would really be a great help to my future coding/javalearning.
Once again, the reason for this approach is that I haven't yet learned
JSP(my servlets print the HTML) or using beans.
Thanks