Package org.springframework.web.portlet

Examples of org.springframework.web.portlet.ModelAndView


    int spouseAge = 31;
    request.addParameter("name", name);
    request.addParameter("age", "" + age);
    request.addParameter("spouse", spouseName);
    request.addParameter("spouse.age", "" + spouseAge);
    ModelAndView mav = tc.handleRenderRequest(request, response);
    TestBean command = (TestBean)mav.getModel().get(tc.getCommandName());
    assertEquals(name, command.getName());
    assertEquals(age, command.getAge());
    assertNotNull(command.getSpouse());
    assertEquals(spouseName, command.getSpouse().getName());
    assertEquals(spouseAge, command.getSpouse().getAge());
    BindException errors = (BindException)mav.getModel().get(ERRORS_KEY);
    assertEquals("There should be no errors", 0, errors.getErrorCount());
  }
View Full Code Here


        e.reject(errorCode, defaultMessage);
      }
    });
    MockRenderRequest request = new MockRenderRequest();
    MockRenderResponse response = new MockRenderResponse();
    ModelAndView mav = tc.handleRenderRequest(request, response);
    BindException errors = (BindException)mav.getModel().get(ERRORS_KEY);
    assertEquals("There should be 1 error", 1, errors.getErrorCount());
    ObjectError error = errors.getGlobalError();
    assertEquals(error.getCode(), errorCode);
    assertEquals(error.getDefaultMessage(), defaultMessage);
  }
View Full Code Here

    });
    MockRenderRequest request = new MockRenderRequest();
    int age = 32;
    request.setParameter("age", "" + age);
    MockRenderResponse response = new MockRenderResponse();
    ModelAndView mav = tc.handleRenderRequest(request, response);
    TestBean command = (TestBean)mav.getModel().get(tc.getCommandName());
    assertNull("name should be null", command.getName());
    assertEquals(age, command.getAge());
    BindException errors = (BindException)mav.getModel().get(ERRORS_KEY);
    assertEquals("There should be 1 error", 1, errors.getErrorCount());
    FieldError error = errors.getFieldError("name");
    assertEquals(error.getCode(), errorCode);
    assertEquals(error.getDefaultMessage(), defaultMessage);
  }
View Full Code Here

    int age = 32;
    String whitespace = "  \t  ";
    request.setParameter("age", "" + age);
    request.setParameter("name", whitespace);
    MockRenderResponse response = new MockRenderResponse();
    ModelAndView mav = tc.handleRenderRequest(request, response);
    TestBean command = (TestBean)mav.getModel().get(tc.getCommandName());
    assertTrue(command.getName().equals(whitespace));
    assertEquals(age, command.getAge());
    BindException errors = (BindException)mav.getModel().get(ERRORS_KEY);
    assertEquals("There should be 1 error", 1, errors.getErrorCount());
    FieldError error = errors.getFieldError("name");
    assertEquals("rejected value should contain whitespace", whitespace, error.getRejectedValue());
    assertEquals(error.getCode(), errorCode);
    assertEquals(error.getDefaultMessage(), defaultMessage);
View Full Code Here

      assertNotNull(command);
      assertNotNull(errors);
      Map model = new HashMap();
      model.put(getCommandName(), command);
      model.put(ERRORS_KEY, errors);
      return new ModelAndView(request.getContextPath() + "-view", model);
    }
View Full Code Here

  private ModelAndView handleException(FlowException e, FlowHandler flowHandler, RenderRequest request,
      RenderResponse response) {
    String viewName = flowHandler.handleException(e, request, response);
    if (viewName != null) {
      return new ModelAndView(viewName);
    } else {
      return defaultHandleException(flowHandler, e, request, response);
    }
  }
View Full Code Here

        }
        model.put("groups", groups);
       
        model.put("renderRequest", request);

        return new ModelAndView("constraintsView", "model", model);
 
View Full Code Here

        }
        model.put("groups", groups);
       
        model.put("renderRequest", request);

        return new ModelAndView("constraintsView", "model", model);
 
View Full Code Here

    renderRequest.setContextPath("/springtravel");
    flowExecutor.launchExecution("foo", flowInput, renderContext);
    FlowExecutionResult result = FlowExecutionResult.createPausedResult("foo", "12345");
    EasyMock.expectLastCall().andReturn(result);
    EasyMock.replay(new Object[] { flowExecutor });
    ModelAndView mv = controller.handleRender(renderRequest, renderResponse, flowHandler);
    assertNull(mv);
    EasyMock.verify(new Object[] { flowExecutor });
  }
View Full Code Here

    };
    renderRequest.setContextPath("/springtravel");
    flowExecutor.launchExecution("foo", flowInput, renderContext);
    EasyMock.expectLastCall().andThrow(flowException);
    EasyMock.replay(new Object[] { flowExecutor });
    ModelAndView mv = controller.handleRender(renderRequest, renderResponse, flowHandler);
    assertNotNull(mv);
    assertEquals("error", mv.getViewName());
    EasyMock.verify(new Object[] { flowExecutor });
  }
View Full Code Here

TOP

Related Classes of org.springframework.web.portlet.ModelAndView

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.