Archives: Struts

Java Struts – Logging with Log4j Example

Logging in Struts – Java Log4j Example

Download Log4j:

Log4j Appender:
Create a Log4j properties file ( and define the appender details (where to log and log file details). And put the into your project classpath.

Struts Action Class:

Struts Custom Exception Handler:

Log4j Output File Sample- c:\\logging.log

Java Struts – Handle HTTP 404 Error

Java Struts 404 Error Page Example

The “HTTP Status 404” error code shows that the system can not find the page or resource you requested. In practice, you should display your custom 404 error page. However, it is handle in web.xml , not in Struts framework. For example,

When system hit the 404 error, it will forward to your custom 404 error page “/pages/error404.jsp“.