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
Explain about struts relation to html tags?
Describe the mvc on struts?
how does request processor relates to action mapping?
What is the purpose of @key annotation annotation?
What is the purpose of @keyproperty annotation annotation?
Which servlet does the struts framework use?
Where can I get help with struts?
Which library is provided by struts for form elements like check boxes, text boxes etc?
What is the purpose of struts.xml in struct2?
What are the core components of a struct2 based application?
Describe validate() and reset() methods.
Explain the difference between plain-validator and field-validator in struts?
What is difference between spring and struts?
What do you mean by action errors and what are the results they force?
What do you mean by actionservlet?