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 do you mean by inner class and anonymous class?
What is the difference between Jakarta Struts and Apache Struts? Which one is better to use?
What is the purpose of @conversion annotation annotation?
What is spring and struts in java?
What is form bean in struts?
What are the sections into which a strut configuration file can be divided?
What is action support class in struts2?
Can we handle exceptions in Struts programmatically?
What is struts in j2ee?
Explain about the process of functioning of the struts program?
How do you convert struts to springs?
What is meant by custom tags?
What is struts framework?
What is the use of forwardaction?
Is there a particularly good ide to use with struts?