First of all, what have you done so far? No one here is going to do your work for you, but we'll help you along.
Secondly, JSP is for display,
not processing. You'll need to do most of the work in a
servlet or other
Java class, then use a JSP merely to display the results.