This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Are you really placing your application logic in your JSP page? You really shouldn't do this. Place your application logic in a Servlet instead (in fact, place your application logic in utility classes which are called from your servlet). Then, just have the JSP page display the results. Read up on Model-View-Controller (MVC). This way, you can easily test your application logic without the need to actually execute the JSP.
As for your specific problem, it sounds like your connection doesn't like the fact that you're getting the result value more than once. Rather than calling rs.getString(1) multiple times, why not assign the value to a variable, then use that variable in the multiple places as necessary?