You need to separate view from logic, meaning move that database connectivity to a class that will be called by servlet and do not do this in JSP. Check out MVC tutorial at the top of JSP section for more suitable approach
peter_budo
Code tags enforcer
15,788 posts since Dec 2004
Reputation Points: 2,867
Solved Threads: 944
Skill Endorsements: 50