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
What are pull and push mvc architecture and which architecture does struts2 follow?
What is action chaining ?
What is the purpose of global-forwards tag in struct-config.xml?
How can we work with error tags?
When should be opt for struts framework?
What helpers in the form of jsp pages are provided in struts framework?
What applications use apache struts?
How is the mvc design pattern used in struts framework?
How is token generated?
What are the action classes in struts?
How can we get Servlet API Request, Response, HttpSession etc Objects in action classes?
What does i18n interceptor?
What is the purpose of @emailvalidator annotation?
What is the purpose of @key?
What is interceptor? And life cycle methods of interceptor?