hi everyone , i m doig a project in servlets to get the username n passowrd from the user and then displaying their mail inbox ..... for example. if we want to display the search results of the word " mail " in google we can do it by the method "res.sendRedirect(http://www.google.com/search?nhl=en&lr=&q=mail); " but how can we use this sendredirect method to access the mail like providing user name and password and then displaying their inbox to users.
You can't. Accessing a mail account is completely different than accessing a web page (for starters, it's done using the POP or IMAP protocols, not HTTP). You need to use the JavaMail API to retrieve the mailbox contents, and then convert that to a web view. But there are a number of Java web apps out there that do exactly this and are open source, so there's not much point in reinventing the wheel (unless the point is to learn web app development and JavaMail). [ January 02, 2007: Message edited by: Ulf Dittmer ]
hi thanks a lot. . . . ok how about any other web page or site that requires authentication that is we need to provide the user name and passowrd to access the site .. in those case how we should do it?
Joined: Mar 22, 2005
I'm not sure what you mean by "how we should do it". If a web site requires authentication, then you'll have to enter username and password when it asks for it. Or or are you trying to access a password-protected web app programmatically? Then you'd set the authentication header as described here.