You wouldn't use a query to insert rows. And definitely not in a JSP.
I'm going to assume that your problem is something to do with JDBC so I will move the post to that forum; it would also help if you described your problem more fully. Where does the data come from? What have you tried so far? What does JSP have to do with it? And so on.
Please do not shoot the fish in this barrel. But you can shoot at this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop