Duke Martin <[EMAIL PROTECTED]> wrote:
>I have a servlet that reads files from a server and displays the info in
>HTML format. In your opinion, what is the best way to display different
>info based on the user-login? For example, if I log in, the servlet reads
>from myfile.txt, but if you logged in it would read and display the info in
>yourfile.txt. Any suggestions???
If your question is, "How do I do authentication?" the answer is:
Check out Jason Hunter's book:
http://www.servlets.com/jsp/buy.html
or this URL:
http://novocode.de/doc/servlet-essentials/chapter4b.html#4_5
If your question is, "Once I get a user name, how do I get the right file?"
the answer is:
StringBuffer filename = new StringBuffer();
filename.append( request.getRemoteUser() );
filename.append( ".txt" );
File file = new File( "/path/to/data/files/", filename.toString() );
/* [extract data from file] */
/* [return html] */
Erik
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html