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

How to use dispatchaction?

749


What is includeaction?

742


What is the use of forwardaction?

711


What is the purpose of @action annotation?

742


Describe the basic steps used to create a tiles application?

750






What is the purpose of '@customvalidator'?

767


What is a custom tag?

688


What is controller in struts ?

695


What is ValueStack and OGNL?

750


What is the purpose of @doublerangefieldvalidator annotation?

744


How is a lookup dispatch action created?

728


What is the purpose of @conversion?

795


What is the purpose of @customvalidator annotation?

711


What is Custom Type Converter in Struts2?

829


What do you mean by struts.dev mode?

692