Hai all.Can i develope Struts action class without execute(-,-
,-,-)method.Ifd it's possible plz provide some sample code.
Answers were Sorted based on User's Feedback
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 |
Answer / shashi
Yes , we have just use the Dispatch Action class for ignore the execute method.
| Is This Answer Correct ? | 16 Yes | 1 No |
Answer / naman patidar
I want to add some points reply of Sreekanth Madamanchi.
1. DynaAction class should be used only when you are having
more then one action on you form.
2. JSP must have same action name as of method in the action
class
| Is This Answer Correct ? | 11 Yes | 0 No |
What is Portlet???? when,where and why we use it ??
3 Answers Infotech, Rebaca, Wipro,
What is Model 1 and Model 2?
What is the difference between validation.xml and validator-rules.xml files in struts validation framework?
how can u handle run time exceptions in struts and jsp plz explain briefly not single word answer?
What is the purpose of struct-config.xml in struct2?
How do you find the struts version being used in a project?
What is the life cycle of actionform?
what is the disadvantages of using DynaActionForm in struts framework?
Why we use struts over servlets?
What are the benefits of Struts framework?
What is the use of reset method of ActionForm class?
What is the purpose of @key annotation annotation?