Using servlet to handle database connection

Discussions

Web tier: servlets, JSP, Web frameworks: Using servlet to handle database connection

  1. Using servlet to handle database connection (1 messages)

    Hi there,

    I have been successful in calling database content from both a servlet and from a jsp. I now want to use a servlet to handle the connection details and only display the content in the jsp. Is this possible??

    Thanks very much for any help!

    Pedro
  2. U can use the <jsp:useBean> tag to call the bean. You can put yr business logic as in your case the database connection properties in the bean and access the bean from jsp page using the useBean tag.

    <jsp:useBean id="someid" scope="session" class="SomeClass" />

    <%! ResultSet rs; %>

    <% rs = someid.getData(); %>