Package org.strecks.action

Examples of org.strecks.action.BasicSubmitAction


  {

    BasicSubmitController action = new BasicSubmitController();
    ActionForward actionForward = new ActionForward();

    BasicSubmitAction actionBean = createStrictMock(BasicSubmitAction.class);
    ActionMapping mapping = createStrictMock(ActionMapping.class);
    DelegatingForm form = createStrictMock(DelegatingForm.class);
    HttpServletRequest request = createStrictMock(HttpServletRequest.class);

    expect(request.getAttribute(Globals.CANCEL_KEY)).andReturn(null);
    actionBean.preBind();
    form.bindInwards(actionBean);
    expect(actionBean.execute()).andReturn("success");
    expect(mapping.findForward("success")).andReturn(actionForward);

    replay(actionBean);
    replay(mapping);
    replay(form);
View Full Code Here


  {

    BasicSubmitController action = new BasicSubmitController();
    ActionForward actionForward = new ActionForward();

    BasicSubmitAction actionBean = createStrictMock(BasicSubmitAction.class);
    ActionMapping mapping = createStrictMock(ActionMapping.class);
    DelegatingForm form = createStrictMock(DelegatingForm.class);
    HttpServletRequest request = createStrictMock(HttpServletRequest.class);

    expect(request.getAttribute(Globals.CANCEL_KEY)).andReturn(Boolean.TRUE);
    expect(actionBean.cancel()).andReturn("success");
    expect(mapping.findForward("success")).andReturn(actionForward);

    replay(actionBean);
    replay(mapping);
    replay(form);
View Full Code Here

  {

    BasicSubmitController action = new BasicSubmitController();
    ActionForward actionForward = new ActionForward();

    BasicSubmitAction actionBean = createStrictMock(BasicSubmitAction.class);
    ActionMapping mapping = createStrictMock(ActionMapping.class);
    BasicActionForm form = createStrictMock(BasicActionForm.class);
    HttpServletRequest request = createStrictMock(HttpServletRequest.class);

    expect(request.getAttribute(Globals.CANCEL_KEY)).andReturn(null);
    expect(actionBean.execute()).andReturn("success");
    expect(mapping.findForward("success")).andReturn(actionForward);

    replay(actionBean);
    replay(mapping);
    replay(form);
View Full Code Here

  {

    BasicSubmitController action = new BasicSubmitController();
    ActionForward actionForward = new ActionForward();

    BasicSubmitAction actionBean = createStrictMock(BasicSubmitAction.class);
    ActionMapping mapping = createStrictMock(ActionMapping.class);
    BasicActionForm form = createStrictMock(BasicActionForm.class);
    HttpServletRequest request = createStrictMock(HttpServletRequest.class);

    expect(request.getAttribute(Globals.CANCEL_KEY)).andReturn(Boolean.TRUE);
    expect(actionBean.cancel()).andReturn("success");
    expect(mapping.findForward("success")).andReturn(actionForward);

    replay(actionBean);
    replay(mapping);
    replay(form);
View Full Code Here

  @Override
  protected ViewAdapter executeAction(Object actionBean, ActionContext context)
  {
 
    BasicSubmitAction action = (BasicSubmitAction) actionBean;
    ActionForm form = context.getForm();
 
    HttpServletRequest request = context.getRequest();
 
    boolean cancelled = false;
    if (request.getAttribute(Globals.CANCEL_KEY) != null)
    {
      cancelled = true;
    }
   
    //FIXME call deferred form validation here
   
    //FIXME call validation methods here
 
    if (form instanceof BindingForm && !cancelled)
    {
      action.preBind();
      BindingForm bindingForm = (BindingForm) form;
      bindingForm.bindInwards(actionBean);
    }
 
    String result = cancelled ? action.cancel() : action.execute();
    return getActionForward(context, result);
 
  }
View Full Code Here

  @Override
  protected ViewAdapter executeAction(Object actionBean, ActionContext context)
  {

    BasicSubmitAction action = (BasicSubmitAction) actionBean;

    ActionForm form = context.getForm();

    HttpServletRequest request = context.getRequest();

    boolean cancelled = false;
    if (request.getAttribute(Globals.CANCEL_KEY) != null)
    {
      cancelled = true;
    }

    if (form instanceof BindingForm && !cancelled)
    {

      action.preBind();
      BindingForm validBindingForm = (BindingForm) form;
      validBindingForm.bindInwards(actionBean);

    }

    ActionMapping mapping = context.getMapping();
    String result = null;

    if (cancelled)
    {
      result = action.cancel();
    }
    else
    {

      // now figure out what method to execute and do so

      String parameterName = mapping.getParameter();

      getHelper().checkParameterName(mapping, parameterName);

      String methodName = getMethodName(context, parameterName);

      if (methodName == null)
      {
        result = action.execute();
      }
      else
      {
        Method method = getHelper().getMethod(actionBean, methodName);
        result = ReflectHelper.invokeMethod(actionBean, method, String.class);
View Full Code Here

TOP

Related Classes of org.strecks.action.BasicSubmitAction

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.