User login

Why do we override the execute method in struts in DWH context?

 

As part of Struts FrameWork we can develop the Action Servlet,ActionForm servlets(here ActionServlet means which class extends the Action class is called ActionServlet and ActionForm means which class extends the ActionForm class 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 retain 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.

0
Your rating: None

Syndicate

Syndicate content