Hi all,

Is it possible to set a forward like this in the struts-config.xml ?
<forward name="addcompany"      path="/addcompany.OTM?action=preadd"/>
<action  path="/addcompany"
          scope="request"
           name="AddCompanyForm"
           type="AddCompanyAction">
   <forward name="add"     redirect="false" path="/addcompanyform.jsp"/>
   <forward name="success" redirect="false" path="/index.jsp"/>
   <forward name="failure" redirect="false" path="/addcompanyform.jsp"/>
  </action>

And then, call from the perform method in the Action Class other
customPerform
method  like following :

import ...;

public final class AddCompanyAction extends Action {

 public ActionForward perform(
  ActionMapping mapping,
  ActionForm form,
  HttpServletRequest request,
  HttpServletResponse response)
  throws IOException, ServletException {

  Locale locale = getLocale(request);
  MessageResources messages = getResources();
  String action = request.getParameter("action");
    if ("preadd".equals(action)) {
    return (new ActionForward("success"));
  }

 else  if ("add".equals(action)) {
   return performAdd(mapping, form, request, response);
  }

else {
  return (new ActionForward(mapping.getInput()));
  }

 }

 public ActionForward performAdd(
  ActionMapping mapping,
  ActionForm form,
  HttpServletRequest request,
  HttpServletResponse response)
  throws IOException, ServletException {

  Locale locale = getLocale(request);
  MessageResources messages = getResources();

// Some stuff .....

  return (new ActionForward(mapping.getInput()));
 }
}

Thanks All

Dams


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to