How exception handling is provided in struts?

Answer Posted / sitaram

to handle the errors:

in struts project to handle the error objet by using
ActionError object and to handle the errors by using
ActionErrors object.

for suppose

ActionError ae1=new ActionError("err.one");

ActionError ae2=new ActionError("err.two");

Action Errors aes=new ActionErrors();

aes.add(ae1);

aes.add(ae2);

saveErrors(request,aes);//store the errors object in request
object

to handle exception:

1)using try and cach blocks

2)using declarative exception handling technique

to handle the exceptions by using global exceptons tag in
struts-config.xml

<global-exceptions>

<exception key="gen.err"
type="java.lang.ClassNotFoundException" path="/gen.jsp"/>

whenever that exception will be came it executes the
gen.jsp page.

Is This Answer Correct ?    12 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What configuration changes are required to use Tiles in Struts?

570


What is the use of lookupdispatchaction?

566


How can we upload files in Struts2 application?

592


What is package name in struts xml?

563


What is the use of token interceptor in Struts2?

623






Why do we use struts?

579


What are the core components of a struct2 based application?

564


What is the different actions available in struts?

546


What is the difference between validation.xml and validator-rules.xml files in struts?

513


What are the contents on web.xml in struts application ?

520


What is the purpose of struts.properties in struct2?

531


Who makes the struts?

551


What is the purpose of action-mappings tag in struct-config.xml?

592


Why do the struts tags provide for so little formatting?

588


Explain about how requests from the client are sent?

524