How to set email notification using struts.Plz give the
example code?

Answer Posted / anas

Solution is to implement an email notification system. The
notification system will generate an email message whenever
the application detects an error. If you are already using
a standard logging framework like log4j.

import java.util.logging.*;
public class JDKLoggingExample
{
private static final Logger log =
Logger.getLogger(JDKLoggingExample.class.getName());
public static void main(String[] args)
{
try
{
log.fine("This is a fine message.");
int i = Integer.parseInt("Hello world");
}
catch (java.lang.Exception ex)
{
log.log(Level.SEVERE, "Caught an exception",
ex);
}
}

---------------------------------------------------------

import org.apache.log4j.*;

public class Log4jExample
{

private static final Logger log =
Logger.getLogger(Log4jExample.class);

public static void main(String[] args)
{
try
{
log.debug("This is a debug message.");
int i = Integer.parseInt("Hello world");
}
catch (java.lang.Exception ex)
{
log.error("Caught an exception", ex);
}
}
}

Is This Answer Correct ?    3 Yes 11 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is action chaining ?

629


Is struts efficient?

489


What is struts.devmode?

571


What is the purpose of @conversion annotation annotation?

591


What’s the difference between struts and espresso?

500






Do you need an alignment after replacing struts?

520


Can I have html form property without associated getter and setter formbean methods?

569


What is the purpose of @element?

580


What is the purpose of @keyproperty annotation annotation?

576


What is interceptor in Struts2?

565


What is struts-default package and what are it’s benefits?

573


What is the purpose of @customvalidator annotation?

569


What do you mean by action errors and what are the results they force?

572


What is difference between interceptors and filters?

530


Explain about struts dispatch action?

544