Originally posted by Grady Jamyson: It works, thanks a lot. I don't know why the codes in that area have this kind of effect.
When you use the <%! %> construct, the declarations within are placed at the class level of the servlet that is created by the container on behalf of your JSP. Thus, your initialization was happening when the class was loaded, and never again.
This is one of the many reasons that sciptlet coding, such as you are doing, is discouraged in modern JSPs in favor of better (and less error prone) mechanisms.
Would you recommend books or websites to study?
The JSP Specification (link in JSP FAQ) is the horse's mouth, [ December 20, 2006: Message edited by: Bear Bibeault ]