Actually in my application i take a zip file which contains some files and upload it to a server. After uploading i am giving a link to download that file. When a user clicks that link a servlet will execute and a dialog box will appear with options ( open , save and cancel ).
My current requirement is when ever user clicks that link he should be prompted with a dialog box for authentication( he needs to enter username and password). If he enters correct credentials he can download or else it should go to error page...
Please some one guide me how to implement this.. I am new to this... Thanks in advance..
When the user clicks that click, instead of servlet, let the HTML page get displayed, which asks for username and password, from there pass the control to the servlet, using action attribute.. Then, in the servlet, code which is for downloading the file, can be wriiten inside a if condition, that if condition, will check for the authentication method returning true or false.., By the By, how you need to authenticate? Is it against the data stored in database..