ContactUs

Please send your Questions & Answers or Feedback to "mohan@javabook.org"

What's the purpose of Execute method of action class?

Execute method of action class is responsible for execution of business logic. If any processing is required on the user’s request, it’s performed in this method. This method returns actionForward object which routes the application to appropriate page.

In the following example, execute method will return an object of actionForward defined in struts-config.xml with the name “exampleAction”:

[java]

import javax.servlet.http.HttpServletRequest;

import javax.servlet.http.HttpServletResponse;

import org.apache.struts.action.Action;

import org.apache.struts.action.ActionForm;

import org.apache.struts.action.ActionForward;

import org.apache.struts.action.ActionMapping;

public class actionExample extends Action

{

public ActionForward execute(

ActionMapping mapping,

ActionForm form,

HttpServletRequest request,

HttpServletResponse response) throws Exception{

return mapping.findForward(“exampleAction”);

}

}

[/java]

Related Posts Plugin for WordPress, Blogger...
Flag Counter