inter servlet communication
- by mithun1538
Hello everyone,
I have two servlets: LoginServlet and MailServlet. LoginServlet queries a mysql table using jdbc to get a string(eMail). What I want is to forward this string to MailServlet which in turn will send an email to that e-mail ID sent by LoginServlet.
My question is how do I call and send the variable eMail to MailServlet, from LoginServlet? I thought of creating an instance of the MailServlet as :
MailServlet servlet = new MailServlet();
And then use the servlet object to call the function doGet() in MailServlet.
But I am feeling that there is some error in this as this is not the right way to call a servlet. So how do I call and pass a variable to MailServlet?