Why do we override the execute method is struts? Plz give me the details?

Showing Answers 1 - 1 of 1 Answers

RaviKumar Reddy

  • May 18th, 2006
 

 As part of Struts FrameWork we can decvelop the Action Servlet,ActionForm servlets(here ActionServlet means which class extends the Action class is called ActionServlet and ActionFome means which calss extends the ActionForm calss is called the Action Form servlet)and other servlets classes.

In case of ActionForm class we can develop the validate().this method will return the ActionErrors object.In this method we can write the validation code.If this method return null or ActionErrors with size=0,the webcontainer will call the execute() as part of the Action class.if it returns size > 0 it willnot be call the execute().it will execute the jsp,servlet or html file as value for the input attribute as part of the <action -mapping> attribute in struts-config.xml file.

In case of Action class the execute() method retuen the ActionForward object.in execute() we can write (return mapping.findForward("success");)here mapping is the object for the ActionMapping class.After that it will forward the request to the "success" jsp file.(here success is context path for the jsp file,it is written in web.xml. 

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.

 

Related Answered Questions

 

Related Open Questions