File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java mail through jsp

 
susham kumar
Greenhorn
Posts: 2
Java Netbeans IDE Tomcat Server
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi, i have used java mail for sending mail by making gmail as smtp server... its getting executed as and desktop application but when it comes to web application i couldn't execute it. problem is with the authentication class which is included in my application
class PasswordAuthenticator extends

javax.mail.Authenticator {
public PasswordAuthentication

getPasswordAuthentication() {
String user = "****************";
String pwd = "********";
return new PasswordAuthentication(user, pwd);
}
}

this class is called in the main program, of my mail application.. how to include both the classes in web.xml file when i use servlets and how to include both main class and the above class in JSP.
 
Paul Clapham
Sheriff
Pie
Posts: 20161
24
MySQL Database
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You don't need to declare your authenticator class in web.xml. Neither do you need to import it in your JSP, if you are still writing antiquated JSP code which has embedded Java. All you need to do is make sure it gets deployed with your web application along with your other classes. It should go either in WEB-INF/classes or else in a jar in WEB-INF/lib.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic