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 use of struts?

507


What are the custom tags?

522


What is the purpose of @beforeresult?

599


What is actionservlet?

552


How can we write our own interceptor and map it for action?

560






How is the action mapping specified?

537


What is struts.devmode?

567


Name some useful annotations introduced in Struts2?

526


How exceptions are handled in struts application?

527


Does struts include its own unit tests?

516


Is there a particularly good ide to use with struts?

494


Mark the differences between html tags and strut specific html tags.

580


How duplicate form submission can be controlled in struts?

634


What does validation interceptor?

542


Which interceptor is responsible for i18n support?

512