Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

java mail through jsp

 
susham kumar
Greenhorn
Posts: 2
Java Netbeans IDE Tomcat Server
  • 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: 20775
30
Eclipse IDE Firefox Browser MySQL Database
  • 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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic