Monday, September 7, 2015

Declarative Exception handling in struts


Declarative programming is a way to separate Control from computation logic . Exception handling in java is usually done using try catch and throws . In jsp we can handle exceptions using errorPage attribute of page declarative . Any exception occurred will be routed to the value of errorPage attribute . In addition to this struts offer similar way of handling exception . Use exception tags in StrutsConfig.xml to declare excpetion handling . All exception tags should be enclosed under global-Exception tag. Type of exception is mentioned in type attribute , exception message is mentioned in key attribute and the page which is called in case of exception is mentioned in path attribute of exception tag . The action exception message is picked from MessageResource.properties file for the key in key attribute .

No comments:

Post a Comment

ec2-user@ec2 Permission denied