File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Servlets and the fly likes Authentication Dialog Box Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "Authentication Dialog Box" Watch "Authentication Dialog Box" New topic

Authentication Dialog Box

Avinash venna

Joined: Jun 10, 2010
Posts: 17
Hi all,

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..

Avinash venna

Joined: Jun 10, 2010
Posts: 17
Some one look into this please...
Prasad Krishnegowda
Ranch Hand

Joined: Apr 25, 2010
Posts: 662

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..
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
Would servlet security for the download URL be sufficient?
I agree. Here's the link:
subject: Authentication Dialog Box
It's not a secret anymore!