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
What is difference between actionform and dynaactionform?
Explain the life cycle of a request in struct2 application?
What is the differences between struts1 and struts2?
how to debug struts project in netbean ?
How struts control data flow?
Why do the struts tags provide for so little formatting?
How is a lookup dispatch action created?
How you will make available any message resources definitions file to the struts framework environment?
Where can I get help with struts?
Which design pattern the interceptors in struts2 is based on?
What is struts and why it is used?
Which technologies can be used at view layer in struts?
What are the important methods of actionform?
What is the use of execAndWait interceptor?
How the exceptions are handled in struts?