Web tier: servlets, JSP, Web frameworks: Java class with JSP
I wrote a java class to connect to database and then use JSP to call the java class to get the output that is read from the database.
It give me error. I use WebSphere.
================ some of the code in java class ============
connectdb,closedb database method under try and catch
wrote a select method under try and catch
wrote main and call connectdb, the quary method and closedb
=========== JSP code =============
call the java class under try and catch
Do you want to copy the whole code?
You don't have nearly enough stuff up there to debug whats going wrong.
But if all you want is to read some stuff out of the DB and dump it on you page you may want to look at the JSTL SQL tag libraries. They will connect to the database and do queries straight from the JSP page. Its not very scalable or easy to maintain, but it does work.
Here is a paper describing how to use them, look about half way down..
You can download a free copy of the JSTL tags from apache.