Package org.apache.struts.action

Examples of org.apache.struts.action.ActionForward


      if (!lform.getPassword().equals(user.getPassword())) {
        ActionError error = new ActionError("error.login.badPassword");
        ActionErrors errors = new ActionErrors();
        errors.add("password", error);
        request.setAttribute(ERROR_KEY, errors);
        return (new ActionForward(mapping.getInput()));
      }
      Mapping.begin();
      boolean result = new SecurityManagerImpl().canLogIntoBackoffice(user);
      Mapping.rollback();
      if ( !result ) {
        ActionError error = new ActionError("error.login.notAuthorized");
        ActionErrors errors = new ActionErrors();
        errors.add("login", error);
        request.setAttribute(ERROR_KEY, errors);
        return (new ActionForward(mapping.getInput()));
      }
      request.getSession().setAttribute("userLogin",user.getLogin());
    } catch (Exception e) {
      Mapping.rollback();
      ActionError error = new ActionError("error.login.badLogin");
      ActionErrors errors = new ActionErrors();
      errors.add("login", error);
      request.setAttribute(ERROR_KEY, errors);
      return (new ActionForward(mapping.getInput()));
    }  

    // Forward to the newt page
    request.setAttribute("reload","true");
    return (mapping.findForward("ok"));
View Full Code Here


  @Test
  public void testInsertMethod()
  {

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

    SimpleDispatchAction actionBean = createMock(SimpleDispatchAction.class);
    ActionMapping mapping = createMock(ActionMapping.class);
    HttpServletRequest request = createMock(HttpServletRequest.class);
View Full Code Here

  @Test
  public void testUnspecified()
  {

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

    SimpleDispatchAction actionBean = createMock(SimpleDispatchAction.class);
    ActionMapping mapping = createMock(ActionMapping.class);
    HttpServletRequest request = createMock(HttpServletRequest.class);
View Full Code Here

  @SuppressWarnings("unchecked")
  @Test
  public void testHandleWithInterceptors() throws Exception
  {

    ActionForward actionForward = new ActionForward();
    BeforeInterceptor before1 = createStrictMock(BeforeInterceptor.class);
    BeforeInterceptor before2 = createStrictMock(BeforeInterceptor.class);
    Collection<BeforeInterceptor> befores = new ArrayList<BeforeInterceptor>();
    befores.add(before1);
    befores.add(before2);
View Full Code Here

    ActionRedirectNavigationHandler handler = new ActionRedirectNavigationHandler();
    ViewAdapter viewAdapter = handler.getActionForward(new TestContextImpl(request), "action");

    ActionForwardViewAdapter va = (ActionForwardViewAdapter) viewAdapter;
    ActionForward actionForward = va.getActionForward();

    verify(request);
    verify(session);
    verify(redirectHelper);

    assertEquals(actionForward.getPath(), "action.do?param1=value1&param2=value2");
    assert actionForward.getRedirect();

  }
View Full Code Here

  @Test
  public void testNavigationHandler()
  {

    ActionForward actionForward = new ActionForward();

    ActionForwardNavigationHandler handler = new ActionForwardNavigationHandler();
    ViewAdapter viewAdapter = handler.getActionForward(new TestContextImpl(), actionForward);

    ActionForwardViewAdapter va = (ActionForwardViewAdapter) viewAdapter;
View Full Code Here

    ExecuteAction executeAction = getExecuteAction(delegate, factory);
    Action action = newMock(Action.class);
    ActionMapping actionConfig = newMock(ActionMapping.class);
    ActionForm actionForm = newMock(ActionForm.class);
    ActionContext actionContext = newMock(ActionContext.class);
    ActionForward forwardConfig = newMock(ActionForward.class);
    HttpServletRequest request = newMock(HttpServletRequest.class);
    HttpServletResponse response = newMock(HttpServletResponse.class);
    ServletContext servletContext = newMock(ServletContext.class);
   
    expect(sac.getRequest()).andReturn(request);
View Full Code Here

  public void testNavigationHandler()
  {

    ActionMapping mapping = createStrictMock(ActionMapping.class);

    ActionForward actionForward = new ActionForward();
    expect(mapping.findForward("success")).andReturn(actionForward);

    replay(mapping);

    MappingNavigationHandler handler = new MappingNavigationHandler();
View Full Code Here

    PageNavigationHandler handler = new PageNavigationHandler();
    ViewAdapter viewAdapter = handler.getActionForward(actionContext, pageClass);

    ActionForwardViewAdapter va = (ActionForwardViewAdapter) viewAdapter;
    ActionForward forward = va.getActionForward();

    assert forward instanceof PageForward;
    assertEquals(forward.getPath(), "page_path");

    verify(pageClass);
    verify(actionContext);
    verify(request);
View Full Code Here

  @Test
  public void testWithValidBindingFormInputError()
  {

    ActionForward actionForward = new ActionForward();

    HttpServletRequest request = createStrictMock(HttpServletRequest.class);
    NavigableFormRenderBean actionBean = createStrictMock(NavigableFormRenderBean.class);
    ActionMapping mapping = createStrictMock(ActionMapping.class);
    DelegatingForm form = createStrictMock(DelegatingForm.class);
View Full Code Here

TOP

Related Classes of org.apache.struts.action.ActionForward

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.