Hi,
I'm making a cd store web app where my index is in
jsp. Within this index page I have another jsp page included that is only to contain the categories of music genres which are stored on my database.
What I want to do is be able to use the jsp:useBean and have the bean read from the database and return the categories perhaps in a resultset so they can be printed out onto the page. My problem is that I'm unsure as to how to go about this.
in my included JSP page:
<% page import="mypackage.categoryBean" %>
<jsp:useBean id="cats" class="mypackage.categoryBean" scope="application" />
As for the rest of this file, would I retrieve the result set by using a getter method?
for instance:
ResultSet r = (ResultSet) cats.getCategories();
As for my categoryBean.java file:
I know that the bean can only have a contructor with no arguments, and that each property must have a method to get and set the value. Am I able to use
JDBC to connect and query my database for the category titles within one of these methods? Or is there a simpler way or doing this?