Hai all.Can i develope Struts action class without execute(-,-
,-,-)method.Ifd it's possible plz provide some sample code.
Answer Posted / sreekanth madamanchi
If your Action class extends from Dyna Action Action, then
you can develop struts action class with out execute
method. Because in that action class we write our own
methods insted of execute method.
EXAMPLE:
public class Dispatch_Action extends DispatchAction
{
public ActionForward add(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws Exception{
System.out.println("You are in add function.");
return mapping.findForward("add");
}
public ActionForward delete(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws Exception
{
System.out.println("You are in delete function.");
return mapping.findForward("delete");
}
public ActionForward search(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws Exception{
System.out.println("You are in search function");
return mapping.findForward("search");
}
public ActionForward save(
ActionMapping mapping,
ActionForm form,
HttpServletRequest request,
HttpServletResponse response) throws Exception{
System.out.println("You are in save function");
return mapping.findForward("save");
}
}
| Is This Answer Correct ? | 20 Yes | 3 No |
Post New Answer View All Answers
What is the actionform?
Explain the difference between jakarta struts and apache struts?
What is defeult result type?
What is the purpose of @after annotation?
how to get the last 10 elements using logic:iterate in struts with hiernate from database.
What is the use of jsonvalidation?
What validate() and reset() method does ?
What is the purpose of action-mappings tag in struct-config.xml?
Describe the basic steps used to create a tiles application?
Which tag is used to declare constants in struts xml?
What is difference between spring and struts?
Is struts action class singleton?
What are the main classes which are used in struts application?
What is struts in java with example?
What is the purpose of execute method of action class?