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’s the difference between struts and turbine? What’s the difference between struts and espresso?
Describe the mvc on struts?
What are the main classes which are used in struts application?
What should be the name of xml file used for validation in struts?
What is the role of a handler in mvc based applications?
What inbuilt themes are provided by struts2?
Does Struts2 action and interceptors are thread safe?
What is value stack?
What is the role of action class in struts?
What are the different kinds of actions in struts?
Which interceptor is responsible for mapping request parameters to action class Java Bean properties?
What is form bean in struts?
What is struts actionmapping?
In struts.xml, what does the attribute "method" stands for in the "action" tag?
What is the purpose of execute method of action class?