Viral, First, note that it is considered bad practice to put Java code - especially database code - in a JSP. It should be in Java objects.
Have you looked at the logs or what line the NullPointer is thrown on yet?
The following code jumps out at me as a problem. If there is an exception loading the connection, a message is logged and the code continues with the connection set to null. This invites the code to blow up later when someone tries creating a statement from that connection.