Welcome to the Ranch, Soumitra!
1. Solve it? I can't even read it! The "Code" button on our message editor allows you to insert tags that will keep code and data/xml samples from getting scrambled like that.
2. Class.forName for database drivers has been obsolete for a very, very long time now.
3. You shouldn't be using the DriverManager in web code. Web servers support database connection pools. It's much more efficient for multi-user webapps.
4. You also shouldn't be coding logic on a
JSP page. That also is a long-obsoleted practice. The JSP should be a template populated by a
servlet. The servlet is where your database code should go.
The secret of how to be miserable is to constantly expect things are going to happen the way that they are "supposed" to happen.
You can have faith, which carries the understanding that you may be disappointed. Then there's being a willfully-blind idiot, which virtually guarantees it.