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 is the naming convention for a resource bundle file in struts2?

541


What is the difference between requestaware and servletrequestaware interface?

580


What are the custom tags?

532


What is structs 2 validation framework?

568


What does i18n interceptor?

585






State an example of struts configuration file as an action parameter for action servlet.

541


What is lookupdispatchaction?

555


When it’s useful to use IncludeAction?

554


Name some of the features of struts2?

573


What is difference between spring and struts?

506


Describe the mvc on struts?

554


What is struts validator framework?

552


What are the Core classes of Struts Framework?

587


Are struts still used?

518


What is the purpose of @createifnull annotation annotation?

621