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

Explain integrate log4j in struts2 application?

564


Are the struts tags xhtml compliant ?

538


Which class is the Front Controller in Struts2?

538


What are the loop holes of struts?

558


How an actionform bean is created?

565






What is actionservlet?

556


What is the use of web xml in struts2?

521


What is struts and springs in java?

524


Why was reload removed from struts (since 1.1)?

540


What are Struts2 core components?

556


What are the custom tags?

528


Explain the difference between dispatchaction and lookupdispatchaction in struts?

2069


What is the purpose of @after?

581


How can we upload files in Struts2 application?

582


What are the differences between http direct and http indirect?

465