The "modern" way -- which has been the professional way for about
eight years now -- is to collect and prepare the data in a
servlet, or some other similar component, before forwarding the collected data to a JSP to be made into HTML.
Doing it that way allows you to use ordinary Java/JDBC code to access the database, so you don't have to concern yourself about "how to access the database from a JSP".
As for accessing multiple tables, you might want to use an SQL join or something like that. But the question is far too lacking in detail for anybody to provide a useful answer.