That's a very poor description of your problem.
Do you want to programatically capture the image, or have a Html button which the user can click and a dialog box pops up saying "Open / Save"
Either way, you want to work out the entire servlet url string.
You can directly type / paste it into a browser address box to test that you have it correct.It should return the image to you.
Once you've got that far, you can either
a) put that servlet url into a html button for the user to click or
b) in java, open a URLConnection to that url, read the data streamed back and save it to a File.
regards,
Owen