Link to home
Start Free TrialLog in
Avatar of Jay Roy
Jay RoyFlag for United States of America

asked on

show backend error on Flex side

higuys

I have a application which submits an email.

this is the flex code
public function sendEmail(event:CloseEvent):void{
workflocomponent.sendEmail(); // this makes a remote java call

My requirment is the following

if(email has been sent sucessfully) {
statusSent.text = "Email has been sent";
}
else if (email has not been sent){
statusError.text = "some error. Contact System Admin."
}
}

<mx:Label id = 'statusSent' fontWeight = 'bold' color = 'green'/>
<mx:Label id = 'statusError' fontWeight = 'bold' color = 'red'/>

This is my simple java method sendEmail()  which is invoked by the above flex code

public void sendEmail() throws Exception{
Properties props = new Properties();
props.put("mail.smtp.host", host);
try {
Transport.send(simpleMessage);            
} catch (MessagingException e)
 {                  
logger.error("Excpetion thrown in SendEmail.send():"+e.getMessage());
}
}

 I am able to see the error message  e.getMessage() in the catch block in java:
catch (MessagingException e) {                  
logger.error("Excpetion thrown in SendEmail.send():"+e.getMessage());
}

I just want to pass the e.getMessage() to flex side. Any ideas?

thanks
ASKER CERTIFIED SOLUTION
Avatar of dgofman
dgofman
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial