princehyderabad
asked on
Passing value into other class
hi experts,
I have a Servlet which calls sendMail.
Servlet:
...
Mail m = new Mail();
m.SendMail(fromAddress, toAddress)
...
Mail class:
..
public String sendMail(java.lang.String from, java.lang.String to)
{
..
InternetAddress[] fromAddress = InternetAddress.parse(from );
...
THE ABOVE CODE WORKS FINE. Now what I'm trying is I need to get a String value as will in here.
Servlet:
...
Mail m = new Mail();
m.SendMail(fromAddress, toAddress, NewValue2Pass)
Now how to get this "NewValue2Pass" value into Mail Class ????
Thx,
PH
I have a Servlet which calls sendMail.
Servlet:
...
Mail m = new Mail();
m.SendMail(fromAddress, toAddress)
...
Mail class:
..
public String sendMail(java.lang.String from, java.lang.String to)
{
..
InternetAddress[] fromAddress = InternetAddress.parse(from
...
THE ABOVE CODE WORKS FINE. Now what I'm trying is I need to get a String value as will in here.
Servlet:
...
Mail m = new Mail();
m.SendMail(fromAddress, toAddress, NewValue2Pass)
Now how to get this "NewValue2Pass" value into Mail Class ????
Thx,
PH
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
do I need to parse that value and use or without parsing I can use.
eg:
String nvp = ????????//how to get values here ???? -- Parse and use
String text ="Message from"+nvp+"for .....";
or
String text ="Message from"+newValues2Pass+"for ....."; (directly use)
eg:
String nvp = ????????//how to get values here ???? -- Parse and use
String text ="Message from"+nvp+"for .....";
or
String text ="Message from"+newValues2Pass+"for ....."; (directly use)
what exactly is it u r trying to do?>
ASKER
This is what I'm trying to do:
....
public String sendMail(java.lang.String from, java.lang.String to, java.lang.String fromName)
{
try {
String textmessage = "You are receiving this notice because:"
+"<b>"+fromName+"</b> has been removed from your pending queue."
...
....
(Tying to display fromName in the text message..)
thx,
PH
....
public String sendMail(java.lang.String from, java.lang.String to, java.lang.String fromName)
{
try {
String textmessage = "You are receiving this notice because:"
+"<b>"+fromName+"</b> has been removed from your pending queue."
...
....
(Tying to display fromName in the text message..)
thx,
PH
that all looks fine, wher eis the problem?
ASKER
Thats all i wanted to know can I used "fromName" in the Text String declaration or I have to parse "fromName" in some string and using this xy string in Text String to get fromName. I think you told its looks fine so that fine :o). Actualy I dont have SMTP to do R&D on it thats why making sure.
Also to add to this:
let say I have 2 mes:
String Message1= "..."
String Message2= "..."
I'm calling this mail class like this: rm.SendMail(to, from, fromName)
how can I use Message1 for to user = "xyz"
how can I use Message2 for to user = "abc"
This is the way I'm setting message:
message.setText(Message1);
Thx, PH
Also to add to this:
let say I have 2 mes:
String Message1= "..."
String Message2= "..."
I'm calling this mail class like this: rm.SendMail(to, from, fromName)
how can I use Message1 for to user = "xyz"
how can I use Message2 for to user = "abc"
This is the way I'm setting message:
message.setText(Message1);
Thx, PH
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
String newValue2Pass = "";
InternetAddress[] fromAddress = InternetAddress.parse(from
newValue2Pass = ????????//how to get values here ????