inter servlet communication

Posted by mithun1538 on Stack Overflow See other posts from Stack Overflow or by mithun1538
Published on 2010-05-15T15:28:19Z Indexed on 2010/05/15 15:34 UTC
Read the original article Hit count: 192

Filed under:
|

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?

© Stack Overflow or respective owner

Related posts about java

Related posts about servlets