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


Please Help Members By Posting Answers For Below Questions

What is the life cycle of actionform?

548


In struts, how can we access java beans and their properties?

553


What is the purpose of @action annotation?

565


What steps are required to for an application migration from Struts1 to Struts2?

604


What are the various struts tag libraries?

542






What are different ways to create Action classes in Struts2?

585


Which design pattern the interceptors in struts2 is based on?

488


What is the struts in java?

501


What is the purpose of '@keyproperty'?

571


What is the purpose of @key annotation annotation?

592


What are the action classes in struts?

516


Briefly tell the two kinds of form beans.

557


Are interceptors and filters different?

543


Name some useful annotations introduced in Struts2?

530


How struts 2 validation works?

573