Reputation:
I am very new to J2EE and don't know how to create custom error page. I have tried with struts.xml as returning input from action but that is not a solution. I want to make global page which is called if any exception arises.
Upvotes: 1
Views: 1888
Reputation:
Create file Error404.jps
& ExceptionHandler.jsp
inside error
directory in webroot. for more issue you can take help from here https://www.mkyong.com/struts/struts-global-custom-exception-example/
just put this code in web.xml
inside web-app tag
<error-page>
<error-code>404</error-code>
<location>/error/Error404.jsp</location>
</error-page>
<error-page>
<error-code>500</error-code>
<location>/error/ExceptionHandler.jsp</location>
</error-page>
Upvotes: 1
Reputation: 840
I think you shoul read "Global Exception Handling". Here is the link:
https://struts.apache.org/docs/exception-handling.html
There is an example configuration.
Upvotes: 1