Package org.apache.struts.action

Examples of org.apache.struts.action.ActionForm


  protected ViewAdapter executeAction(Object actionBean, ActionContext context)
  {

    BasicFormAction action = (BasicFormAction) actionBean;

    ActionForm form = context.getForm();

    boolean hasErrors = hasErrors(context);
    action.setInputError(hasErrors);
   
    if (form instanceof BindingForm && !hasErrors)
View Full Code Here


  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)
View Full Code Here

    private static SubActionWrapper getSubActionWrapper(ActionMapping mapping, ActionForm form, ActionMapping subMapping,
                                                        HttpServletRequest request, int index) throws ClassNotFoundException,
                    IllegalAccessException, InstantiationException, InvocationTargetException {
        String formName = subMapping.getName();
        ActionForm subForm = getActionForm(subMapping, request);

        FormBeanConfig formBean = mapping.getModuleConfig().findFormBeanConfig(formName);
        String className = formBean == null ? null : formBean.getType();
        if (className == null)
            return null;

        if (subForm == null || !className.equals(subForm.getClass().getName()))
            subForm = (ActionForm) Class.forName(className).newInstance();

        if ("request".equals(mapping.getScope()))
            request.setAttribute(formName, subForm);
        else
            request.getSession().setAttribute(formName, subForm);

        subForm.reset(mapping, request);

        /*
         * We dont want to try and populate all forms on a post, only the one
         * that has requested it. For this the form must have a hidden parameter
         * with the name of 'subForm' and the value being the form name to
View Full Code Here

            name = "unspecified";
    // JDR added the ability to refresh all sub forms.
        boolean refreshAll = new Boolean(request.getParameter("refreshAll"));
       
        String subForm = dispatchForm.getSubForm();
        ActionForm subform = (ActionForm) request.getSession().getAttribute(subForm);
        ActionForward fwd = null;

        // Now try to create actions and run the provided action target on each.
        // Any forwards returned are ignored
        for (SubActionWrapper wrapper : subActions) {
View Full Code Here

    @SuppressWarnings("unchecked")
    private void showResource() {
        StrutsExecutionStep executionStep = new StrutsExecutionStep(getRequestPath(), "display", getForwardPath());
        executeStep(executionStep);
       
        ActionForm actionForm = getActionForm();
        assertNotNull("Should not be null", actionForm);
        assertTrue("Should be of type " + actionFormClass.getName(), actionForm.getClass().isAssignableFrom(actionFormClass));

        AbstractResourcesForm<R> resourcesForm = (AbstractResourcesForm<R>) actionForm;
        TableItemModel<R> model = resourcesForm.getModel();
        assertEquals("Should have " + getInitialResourceCount() + " row(s)", getInitialResourceCount(), model.getRowCount());
    }
View Full Code Here

        addRequestParameter("selectedResource", String.valueOf(resource.getResourceId()));
        performActionAndVerifyPath(getInitialRequestPath(), "edit", getRequestPath());

        try {
            performActionAndVerifyTiles("unspecified");
            ActionForm actionForm = getActionForm();
            assertNotNull("Should not be null", actionForm);
            assertTrue("Should be of type " + getActionFormClass().getName(), actionForm.getClass().isAssignableFrom(getActionFormClass()));

            AbstractResourceForm<T> resourceForm = (AbstractResourceForm<T>) actionForm;
            T formResource = resourceForm.getResource();
            assertEquals(resource, formResource);
        } finally {
View Full Code Here

    public void testViewResource() throws DuplicateResourceNameException, NoPermissionException {
        T resource = executeEditRedirect();

        try {
            performActionAndVerifyTiles("view");
            ActionForm actionForm = getActionForm();
            assertNotNull("Should not be null", actionForm);
            assertTrue("Should be of type " + getActionFormClass().getName(), actionForm.getClass().isAssignableFrom(getActionFormClass()));

            AbstractResourceForm<T> resourceForm = (AbstractResourceForm<T>) actionForm;
            assertTrue("Should be read only", resourceForm.getReadOnly());
            T formResource = resourceForm.getResource();
            assertEquals(resource, formResource);
View Full Code Here

    public void testEditResource() throws DuplicateResourceNameException, NoPermissionException {
        T resource = executeEditRedirect();

        try {
            performActionAndVerifyTiles("edit");
            ActionForm actionForm = getActionForm();
            assertNotNull("Should not be null", actionForm);
            assertTrue("Should be of type " + getActionFormClass().getName(), actionForm.getClass().isAssignableFrom(getActionFormClass()));

            AbstractResourceForm<T> resourceForm = (AbstractResourceForm<T>) actionForm;
            T formResource = resourceForm.getResource();
            assertEquals(resource, formResource);
        } finally {
View Full Code Here

        T resource = createResource();
        addRequestParameter("selectedResource", String.valueOf(resource.getResourceId()));
        performActionAndVerifyPath(getInitialRequestPath(), "clone", getRequestPath());
       
        performActionAndVerifyTiles("clone");
        ActionForm actionForm = getActionForm();
        assertTrue("Should be of type " + getActionFormClass().getName(), actionForm.getClass().isAssignableFrom(getActionFormClass()));
        return resource;
    }
View Full Code Here

        T resource = createResource();
        addRequestParameter("selectedResource", String.valueOf(resource.getResourceId()));
        performActionAndVerifyPath(getInitialRequestPath(), "clone", "");
       
        performActionAndVerifyTiles("clone");
        ActionForm actionForm = getActionForm();
        assertTrue("Should be of type " + getActionFormClass().getName(), actionForm.getClass().isAssignableFrom(getActionFormClass()));
        return resource;
    }
View Full Code Here

TOP

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

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.