Can you write a simple Action Class

Q

Can you write a simple Action Class?

✍: Guest

A

Sure. Here is the code of Action Class that returns the ActionForward object:

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;br>
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 TestAction extends Action {
   public ActionForward execute(
      ActionMapping mapping,
      ActionForm form,
      HttpServletRequest request,
      HttpServletResponse response) throws Exception {
	 return mapping.findForward(\"testAction\");
   }
}

2007-12-19, 5016👍, 0💬