Java class with JSP


Web tier: servlets, JSP, Web frameworks: Java class with JSP

  1. Java class with JSP (1 messages)


    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 ============
    ..... other
    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

    ... others

    =========== JSP code =============
    .... others
    import package
    call the java class under try and catch
    .. others
    ======== end

    Please help?

    Do you want to copy the whole code?

    Thank you

  2. Java class with JSP[ Go to top ]

    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.

    Good luck