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



Hai all.Can i develope Struts action class without execute(-,- ,-,-)method.Ifd it's possible p..

Answer / 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

Hai all.Can i develope Struts action class without execute(-,- ,-,-)method.Ifd it's possible p..

Answer / shashi

Yes , we have just use the Dispatch Action class for ignore the execute method.

Is This Answer Correct ?    16 Yes 1 No

Hai all.Can i develope Struts action class without execute(-,- ,-,-)method.Ifd it's possible p..

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

Post New Answer

More Struts Interview Questions

What is used to display the intermediate result in an interceptor?

0 Answers  


advantages& 5 disadvantages of MVC architecture

6 Answers   Satyam, TCS,


Difference between JSF Framework and Struts Framework.

13 Answers   Accenture, BSS, IBM, TCS,


Can we write Structs application without using Action Class directly or indirectly(extends Action class)

5 Answers  


What are the Core classes of Struts Framework?

0 Answers  






Name some useful annotations introduced in Struts2?

0 Answers  


What is the purpose of interceptors?

0 Answers  


Why was reload removed from struts (since 1.1)?

0 Answers  


what is request processor class ?

10 Answers   Fidelity,


When should be opt for struts framework?

0 Answers  


where you will implement the tiles in struts?

2 Answers   Wipro,


What are best practices to follow while developing Struts2 application?

0 Answers  


Categories