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
How to use dispatchaction?
What is includeaction?
What is the use of forwardaction?
What is the purpose of @action annotation?
Describe the basic steps used to create a tiles application?
What is the purpose of '@customvalidator'?
What is a custom tag?
What is controller in struts ?
What is ValueStack and OGNL?
What is the purpose of @doublerangefieldvalidator annotation?
How is a lookup dispatch action created?
What is the purpose of @conversion?
What is the purpose of @customvalidator annotation?
What is Custom Type Converter in Struts2?
What do you mean by struts.dev mode?