Which part are you having problems with - getting the data from the DB, creating an Excel file, streaming the file to the browser, or emailing the file to the user?
For creating an Excel file you can use a library like Apache POI or jExcelApi. You can't stream the file from a JSP, though, because JSPs can't handle binary content. You'll need to do this in a
servlet.