##### Struts Apps

- Welcome

##### Components

- Struts Apps
- Struts EL
- Struts Extras
- Struts Faces
- Struts Scripting
- Struts Taglib
- Struts Tiles

##### Quick Links

- Apache Struts Home
- Struts 1

##### Project Documentation

- Project Information
- Project Reports
  - Checkstyle
  - CPD Report
  - JavaDocs
  - PMD Report
  - Source Xref
  - Surefire Report

## CPD Results

The following document contains the results of PMD's CPD 4.2.2.

## Duplications

File | Line
--- | ---
org\apache\struts\webapp\dispatch\ActionDispatcherExample.java | 42
org\apache\struts\webapp\dispatch\EventActionDispatcherExample.java | 42
                                     = new EventActionDispatcher(this);

        private int fooCount;
        private int barCount;

        /**
         * Execute method.
         *
         * @param mapping The ActionMapping used to select this instance
         * @param form The optional ActionForm bean for this request
         * @param request The servlet request we are processing
         * @param response The servlet response we are creating
         *
         * @exception Exception if business logic throws an exception
         */
        public ActionForward execute(ActionMapping mapping,
                                     ActionForm form,
                                     HttpServletRequest request,
                                     HttpServletResponse response)
            throws Exception {

            return dispatcher.execute(mapping, form, request, response);

        }

        /**
         * Example "foo" method.
         *
         * @param mapping The ActionMapping used to select this instance
         * @param form The optional ActionForm bean for this request
         * @param request The servlet request we are processing
         * @param response The servlet response we are creating
         *
         * @exception Exception if business logic throws an exception
         */
        public ActionForward doFoo(ActionMapping mapping,
                                   ActionForm form,
                                   HttpServletRequest request,
                                   HttpServletResponse response)
            throws Exception {

            fooCount++;

            ActionMessages messages = new ActionMessages();
            messages.add("foo", new ActionMessage("count.foo.message", fooCount+""));
            saveMessages(request, messages);

            return (mapping.findForward("success"));

        }

        /**
         * Example "bar" method.
         *
         * @param mapping The ActionMapping used to select this instance
         * @param form The optional ActionForm bean for this request
         * @param request The servlet request we are processing
         * @param response The servlet response we are creating
         *
         * @exception Exception if business logic throws an exception
         */
        public ActionForward doBar(ActionMapping mapping,
                                   ActionForm form,
                                   HttpServletRequest request,
                                   HttpServletResponse response)
            throws Exception {
            barCount++;

            ActionMessages messages = new ActionMessages();
            messages.add("bar", new ActionMessage("count.bar.message", barCount+""));
            saveMessages(request, messages);

            return (mapping.findForward("success"));

        }

    }

File | Line
--- | ---
org\apache\struts\webapp\dispatch\DispatchExampleAction.java | 37
org\apache\struts\webapp\dispatch\EventDispatchActionExample.java | 37
    public class MappingDispatchExampleAction extends MappingDispatchAction {

        private int fooCount;
        private int barCount;

        /**
         * Example "foo" method.
         *
         * @param mapping The ActionMapping used to select this instance
         * @param form The optional ActionForm bean for this request
         * @param request The servlet request we are processing
         * @param response The servlet response we are creating
         *
         * @exception Exception if business logic throws an exception
         */
        public ActionForward doFoo(ActionMapping mapping,
                                   ActionForm form,
                                   HttpServletRequest request,
                                   HttpServletResponse response)
            throws Exception {

            fooCount++;

            ActionMessages messages = new ActionMessages();
            messages.add("foo", new ActionMessage("count.foo.message", fooCount+""));
            saveMessages(request, messages);

            return (mapping.findForward("success"));

        }

        /**
         * Example "bar" method.
         *
         * @param mapping The ActionMapping used to select this instance
         * @param form The optional ActionForm bean for this request
         * @param request The servlet request we are processing
         * @param response The servlet response we are creating
         *
         * @exception Exception if business logic throws an exception
         */
        public ActionForward doBar(ActionMapping mapping,
                                   ActionForm form,
                                   HttpServletRequest request,
                                   HttpServletResponse response)
            throws Exception {
            barCount++;

            ActionMessages messages = new ActionMessages();
            messages.add("bar", new ActionMessage("count.bar.message", barCount+""));
            saveMessages(request, messages);

            return (mapping.findForward("success"));

        }

    }

File | Line
--- | ---
org\apache\struts\webapp\dispatch\ActionDispatcherExample.java | 63
org\apache\struts\webapp\dispatch\LookupDispatchExampleAction.java | 50
            keyMethodMap.put("button.bar.label", "doBar");
        }

        /**
         * Example "foo" method.
         *
         * @param mapping The ActionMapping used to select this instance
         * @param form The optional ActionForm bean for this request
         * @param request The servlet request we are processing
         * @param response The servlet response we are creating
         *
         * @exception Exception if business logic throws an exception
         */
        public ActionForward doFoo(ActionMapping mapping,
                                   ActionForm form,
                                   HttpServletRequest request,
                                   HttpServletResponse response)
            throws Exception {

            fooCount++;

            ActionMessages messages = new ActionMessages();
            messages.add("foo", new ActionMessage("count.foo.message", fooCount+""));
            saveMessages(request, messages);

            return (mapping.findForward("success"));

        }

        /**
         * Example "bar" method.
         *
         * @param mapping The ActionMapping used to select this instance
         * @param form The optional ActionForm bean for this request
         * @param request The servlet request we are processing
         * @param response The servlet response we are creating
         *
         * @exception Exception if business logic throws an exception
         */
        public ActionForward doBar(ActionMapping mapping,
                                   ActionForm form,
                                   HttpServletRequest request,
                                   HttpServletResponse response)
            throws Exception {
            barCount++;

            ActionMessages messages = new ActionMessages();
            messages.add("bar", new ActionMessage("count.bar.message", barCount+""));
            saveMessages(request, messages);

            return (mapping.findForward("success"));

        }

File | Line
--- | ---
org\apache\struts\webapp\dispatch\ActionDispatcherExample.java | 77
org\apache\struts\webapp\dispatch\MappingDispatchExampleAction.java | 52
        public ActionForward doFoo(ActionMapping mapping,
                                   ActionForm form,
                                   HttpServletRequest request,
                                   HttpServletResponse response)
            throws Exception {

            fooCount++;

            ActionMessages messages = new ActionMessages();
            messages.add("foo", new ActionMessage("count.foo.message", fooCount+""));
            saveMessages(request, messages);

            return (mapping.findForward("success"));

        }

        /**
         * Example "bar" method.
         *
         * @param mapping The ActionMapping used to select this instance
         * @param form The optional ActionForm bean for this request
         * @param request The servlet request we are processing
         * @param response The servlet response we are creating
         *
         * @exception Exception if business logic throws an exception
         */
        public ActionForward doBar(ActionMapping mapping,
                                   ActionForm form,
                                   HttpServletRequest request,
                                   HttpServletResponse response)
            throws Exception {
            barCount++;

            ActionMessages messages = new ActionMessages();
            messages.add("bar", new ActionMessage("count.bar.message", barCount+""));
            saveMessages(request, messages);

            return (mapping.findForward("success"));

        }

    }

File | Line
--- | ---
org\apache\struts\webapp\dispatch\DispatchExampleAction.java | 52
org\apache\struts\webapp\dispatch\LookupDispatchExampleAction.java | 63
        public ActionForward doFoo(ActionMapping mapping,
                                   ActionForm form,
                                   HttpServletRequest request,
                                   HttpServletResponse response)
            throws Exception {

            fooCount++;

            ActionMessages messages = new ActionMessages();
            messages.add("foo", new ActionMessage("count.foo.message", fooCount+""));
            saveMessages(request, messages);

            return (mapping.findForward("success"));

        }

        /**
         * Example "bar" method.
         *
         * @param mapping The ActionMapping used to select this instance
         * @param form The optional ActionForm bean for this request
         * @param request The servlet request we are processing
         * @param response The servlet response we are creating
         *
         * @exception Exception if business logic throws an exception
         */
        public ActionForward doBar(ActionMapping mapping,
                                   ActionForm form,
                                   HttpServletRequest request,
                                   HttpServletResponse response)
            throws Exception {
            barCount++;

            ActionMessages messages = new ActionMessages();
            messages.add("bar", new ActionMessage("count.bar.message", barCount+""));
            saveMessages(request, messages);

            return (mapping.findForward("success"));

        }