There are three parts to your question:
1) How to upload an image - look at the apache commons file upload library
2) Do you want to store the file in the database or on the file system with the database pointing to it.
3) How to store the file/reference in the database - read about JDBC and BLOBs
Note that most of this is done in a servlet or helper class rather than a JSP. JSPs are just for presentation.