Struts Taglib - CPD Results

##### Struts Taglib

- Welcome

##### FAQs and HOWTOs

- Taglib FAQ
- Building View Components
- Indexed Properties

##### Struts Taglib Guides

- Bean
- HTML
- Logic
- Nested

##### Components

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

##### Related Resources

- Display Tag
- html2
- JSTL
- JSF
- Struts Layout
- Struts Menu

##### Quick Links

- Javadoc
- Struts 1

##### Project Documentation

- Project Information
- Project Reports
  - Checkstyle
  - CPD Report
  - JavaDocs
  - PMD Report
  - Source Xref
  - Surefire Report
  - Taglibdoc documentation
  - Tag library validation
  - Tag reference
  - Test JavaDocs
  - Test Source Xref

## CPD Results

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

## Duplications

File | Line
--- | ---
org\apache\struts\taglib\html\LinkTag.java | 190
org\apache\struts\taglib\logic\RedirectTag.java | 153

        }

        public String getName() {
            return (this.name);
        }

        public void setName(String name) {
            this.name = name;
        }

        public String getPage() {
            return (this.page);
        }

        public void setPage(String page) {
            this.page = page;
        }

        public String getAction() {
            return (this.action);
        }

        public void setAction(String action) {
            this.action = action;
        }

        public String getModule() {
            return (this.module);
        }

        public void setModule(String module) {
            this.module = module;
        }

        public String getParamId() {
            return (this.paramId);
        }

        public void setParamId(String paramId) {
            this.paramId = paramId;
        }

        public String getParamName() {
            return (this.paramName);
        }

        public void setParamName(String paramName) {
            this.paramName = paramName;
        }

        public String getParamProperty() {
            return (this.paramProperty);
        }

        public void setParamProperty(String paramProperty) {
            this.paramProperty = paramProperty;
        }

        public String getParamScope() {
            return (this.paramScope);
        }

        public void setParamScope(String paramScope) {
            this.paramScope = paramScope;
        }

        public String getProperty() {
            return (this.property);
        }

        public void setProperty(String property) {
            this.property = property;
        }

        public String getScope() {
            return (this.scope);
        }

        public void setScope(String scope) {
            this.scope = scope;
        }

        public boolean getTransaction() {

File | Line
--- | ---
org\apache\struts\taglib\html\ImgTag.java | 254
org\apache\struts\taglib\html\LinkTag.java | 206

        }

        public String getAction() {
            return (this.action);
        }

        public void setAction(String action) {
            this.action = action;
        }

        public String getModule() {
            return (this.module);
        }

        public void setModule(String module) {
            this.module = module;
        }

        public String getParamId() {
            return (this.paramId);
        }

        public void setParamId(String paramId) {
            this.paramId = paramId;
        }

        public String getParamName() {
            return (this.paramName);
        }

        public void setParamName(String paramName) {
            this.paramName = paramName;
        }

        public String getParamProperty() {
            return (this.paramProperty);
        }

        public void setParamProperty(String paramProperty) {
            this.paramProperty = paramProperty;
        }

        public String getParamScope() {
            return (this.paramScope);
        }

        public void setParamScope(String paramScope) {
            this.paramScope = paramScope;
        }

        public String getProperty() {
            return (this.property);
        }

        public void setProperty(String property) {
            this.property = property;
        }

        public String getScope() {
            return (this.scope);
        }

        public void setScope(String scope) {
            this.scope = scope;
        }

        public String getTarget() {

File | Line
--- | ---
org\apache\struts\taglib\html\ImgTag.java | 254
org\apache\struts\taglib\logic\RedirectTag.java | 169

        }

        public String getAction() {
            return (this.action);
        }

        public void setAction(String action) {
            this.action = action;
        }

        public String getModule() {
            return (this.module);
        }

        public void setModule(String module) {
            this.module = module;
        }

        public String getParamId() {
            return (this.paramId);
        }

        public void setParamId(String paramId) {
            this.paramId = paramId;
        }

        public String getParamName() {
            return (this.paramName);
        }

        public void setParamName(String paramName) {
            this.paramName = paramName;
        }

        public String getParamProperty() {
            return (this.paramProperty);
        }

        public void setParamProperty(String paramProperty) {
            this.paramProperty = paramProperty;
        }

        public String getParamScope() {
            return (this.paramScope);
        }

        public void setParamScope(String paramScope) {
            this.paramScope = paramScope;
        }

        public String getProperty() {
            return (this.property);
        }

        public void setProperty(String property) {
            this.property = property;
        }

        public String getScope() {
            return (this.scope);
        }

        public void setScope(String scope) {
            this.scope = scope;
        }

        public boolean getTransaction() {

File | Line
--- | ---
org\apache\struts\taglib\html\OptionsCollectionTag.java | 308
org\apache\struts\taglib\html\OptionsTag.java | 317

        protected void addOption(StringBuffer sb, String value, String label,
            boolean matched) {
            sb.append("<option value=\"");

            if (filter) {
                sb.append(TagUtils.getInstance().filter(value));
            } else {
                sb.append(value);
            }

            sb.append("\"");

            if (matched) {
                sb.append(" selected=\"selected\"");
            }

            if (style != null) {
                sb.append(" style=\"");
                sb.append(style);
                sb.append("\"");
            }

            if (styleClass != null) {
                sb.append(" class=\"");
                sb.append(styleClass);
                sb.append("\"");
            }

            sb.append(">");

            if (filter) {
                sb.append(TagUtils.getInstance().filter(label));
            } else {
                sb.append(label);
            }

            sb.append("</option>\r\n");
        }

        /**
         * Return an iterator for the option labels or values, based on our
         * configured properties.
         *
         * @param name     Name of the bean attribute (if any)
         * @param property Name of the bean property (if any)
         * @throws JspException if an error occurs
         */
        protected Iterator getIterator(String name, String property)

File | Line
--- | ---
org\apache\struts\taglib\bean\HeaderTag.java | 40
org\apache\struts\taglib\bean\ParameterTag.java | 36

    public class ParameterTag extends TagSupport {
        /**
         * The message resources for this package.
         */
        protected static MessageResources messages =
            MessageResources.getMessageResources(
                "org.apache.struts.taglib.bean.LocalStrings");

        // ------------------------------------------------------------- Properties

        /**
         * The name of the scripting variable that will be exposed as a page scope
         * attribute.
         */
        protected String id = null;

        /**
         * Return an array of parameter values if <code>multiple</code> is
         * non-null.
         */
        protected String multiple = null;

        /**
         * The name of the parameter whose value is to be exposed.
         */
        protected String name = null;

        /**
         * The default value to return if no parameter of the specified name is
         * found.
         */
        protected String value = null;

        public String getId() {
            return (this.id);
        }

        public void setId(String id) {
            this.id = id;
        }

        public String getMultiple() {
            return (this.multiple);
        }

        public void setMultiple(String multiple) {
            this.multiple = multiple;
        }

        public String getName() {
            return (this.name);
        }

        public void setName(String name) {
            this.name = name;
        }

        public String getValue() {
            return (this.value);
        }

        public void setValue(String value) {
            this.value = value;
        }

        // --------------------------------------------------------- Public Methods

        /**
         * Retrieve the required property and expose it as a scripting variable.
         *
         * @throws JspException if a JSP exception has occurred
         */
        public int doStartTag() throws JspException {
            // Deal with a single parameter value
            if (multiple == null) {

File | Line
--- | ---
org\apache\struts\taglib\bean\CookieTag.java | 40
org\apache\struts\taglib\bean\ParameterTag.java | 36

    public class HeaderTag extends TagSupport {
        /**
         * The message resources for this package.
         */
        protected static MessageResources messages =
            MessageResources.getMessageResources(
                "org.apache.struts.taglib.bean.LocalStrings");

        // ------------------------------------------------------------- Properties

        /**
         * The name of the scripting variable that will be exposed as a page scope
         * attribute.
         */
        protected String id = null;

        /**
         * Return an array of header values if <code>multiple</code> is non-null.
         */
        protected String multiple = null;

        /**
         * The name of the header whose value is to be exposed.
         */
        protected String name = null;

        /**
         * The default value to return if no header of the specified name is
         * found.
         */
        protected String value = null;

        public String getId() {
            return (this.id);
        }

        public void setId(String id) {
            this.id = id;
        }

        public String getMultiple() {
            return (this.multiple);
        }

        public void setMultiple(String multiple) {
            this.multiple = multiple;
        }

        public String getName() {
            return (this.name);
        }

        public void setName(String name) {
            this.name = name;
        }

        public String getValue() {
            return (this.value);
        }

        public void setValue(String value) {
            this.value = value;
        }

        // --------------------------------------------------------- Public Methods

        /**
         * Retrieve the required property and expose it as a scripting variable.
         *
         * @throws JspException if a JSP exception has occurred
         */
        public int doStartTag() throws JspException {

File | Line
--- | ---
org\apache\struts\taglib\logic\CompareTagBase.java | 144
org\apache\struts\taglib\logic\MatchTag.java | 105

            String variable = null;

            if (cookie != null) {
                Cookie[] cookies =
                    ((HttpServletRequest) pageContext.getRequest()).getCookies();

                if (cookies == null) {
                    cookies = new Cookie[0];
                }

                for (int i = 0; i < cookies.length; i++) {
                    if (cookie.equals(cookies[i].getName())) {
                        variable = cookies[i].getValue();

                        break;
                    }
                }
            } else if (header != null) {
                variable =
                    ((HttpServletRequest) pageContext.getRequest()).getHeader(header);
            } else if (name != null) {
                Object value =

File | Line
--- | ---
org\apache\struts\taglib\html\OptionsCollectionTag.java | 355
org\apache\struts\taglib\html\OptionsTag.java | 406

            if (collection.getClass().isArray()) {
                collection = Arrays.asList((Object[]) collection);
            }

            if (collection instanceof Collection) {
                return (((Collection) collection).iterator());
            } else if (collection instanceof Iterator) {
                return ((Iterator) collection);
            } else if (collection instanceof Map) {
                return (((Map) collection).entrySet().iterator());
            } else if (collection instanceof Enumeration) {
                return new IteratorAdapter((Enumeration) collection);
            } else {
                throw new JspException(messages.getMessage("optionsTag.iterator",

File | Line
--- | ---
org\apache\struts\taglib\html\ErrorsTag.java | 113
org\apache\struts\taglib\html\MessagesTag.java | 114

        public String getBundle() {
            return (this.bundle);
        }

        public void setBundle(String bundle) {
            this.bundle = bundle;
        }

        public String getLocale() {
            return (this.locale);
        }

        public void setLocale(String locale) {
            this.locale = locale;
        }

        public String getName() {
            return (this.name);
        }

        public void setName(String name) {
            this.name = name;
        }

        public String getProperty() {
            return (this.property);
        }

        public void setProperty(String property) {
            this.property = property;
        }

        public String getHeader() {
            return (this.header);

File | Line
--- | ---
org\apache\struts\taglib\bean\DefineTag.java | 97
org\apache\struts\taglib\bean\SizeTag.java | 86

        public String getId() {
            return (this.id);
        }

        public void setId(String id) {
            this.id = id;
        }

        public String getName() {
            return (this.name);
        }

        public void setName(String name) {
            this.name = name;
        }

        public String getProperty() {
            return (this.property);
        }

        public void setProperty(String property) {
            this.property = property;
        }

        public String getScope() {
            return (this.scope);
        }

        public void setScope(String scope) {
            this.scope = scope;
        }

        // --------------------------------------------------------- Public Methods

        /**
         * Retrieve the required property and expose it as a scripting variable.
         *
         * @throws JspException if a JSP exception has occurred
         */
        public int doStartTag() throws JspException {

File | Line
--- | ---
org\apache\struts\taglib\nested\logic\NestedNotEmptyTag.java | 37
org\apache\struts\taglib\nested\logic\NestedNotPresentTag.java | 38

    public class NestedPresentTag extends PresentTag implements NestedNameSupport {
        /* the usual private member variables */
        private String originalName = null;
        private String originalProperty = null;

        /**
         * Overriding method of the heart of the matter. Gets the relative
         * property and leaves the rest up to the original tag implementation.
         * Sweet.
         *
         * @return int JSP continuation directive. This is in the hands of the
         *         super class.
         */
        public int doStartTag() throws JspException {
            // get the original properties
            originalName = getName();
            originalProperty = getProperty();

            // request
            HttpServletRequest request =
                (HttpServletRequest) pageContext.getRequest();

            // set the properties
            NestedPropertyHelper.setNestedProperties(request, this);

            // let the super do it's thing
            return super.doStartTag();
        }

        /**
         * Complete the processing of the tag. The nested tags here will restore
         * all the original value for the tag itself and the nesting context.
         *
         * @return int to describe the next step for the JSP processor
         * @throws JspException for the bad things JSP's do
         */
        public int doEndTag() throws JspException {
            // do the super's ending part
            int i = super.doEndTag();

            // reset the properties
            setName(originalName);
            setProperty(originalProperty);

            // continue
            return i;
        }

        /**
         * Release the tag's resources and reset the values.
         */
        public void release() {
            super.release();

            // reset the originals
            originalName = null;
            originalProperty = null;
        }
    }

File | Line
--- | ---
org\apache\struts\taglib\nested\logic\NestedMessagesNotPresentTag.java | 38
org\apache\struts\taglib\nested\logic\NestedMessagesPresentTag.java | 38

        implements NestedPropertySupport {
        /* the usual private member variables */
        private String originalName = null;
        private String originalProperty = null;

        /**
         * Overriding method of the heart of the matter. Gets the relative
         * property and leaves the rest up to the original tag implementation.
         * Sweet.
         *
         * @return int JSP continuation directive. This is in the hands of the
         *         super class.
         */
        public int doStartTag() throws JspException {
            // get the original properties
            originalName = getName();
            originalProperty = getProperty();

            // request
            HttpServletRequest request =
                (HttpServletRequest) pageContext.getRequest();

            // set the properties
            NestedPropertyHelper.setNestedProperties(request, this);

            // let the super do it's thing
            return super.doStartTag();
        }

        /**
         * Complete the processing of the tag. The nested tags here will restore
         * all the original value for the tag itself and the nesting context.
         *
         * @return int to describe the next step for the JSP processor
         * @throws JspException for the bad things JSP's do
         */
        public int doEndTag() throws JspException {
            // do the super's ending part
            int i = super.doEndTag();

            // reset the properties
            setName(originalName);
            setProperty(originalProperty);

            // continue
            return i;
        }

        /**
         * Release the tag's resources and reset the values.
         */
        public void release() {
            super.release();

            // reset the originals
            originalName = null;
            originalProperty = null;
        }
    }

File | Line
--- | ---
org\apache\struts\taglib\nested\html\NestedMultiboxTag.java | 37
org\apache\struts\taglib\nested\html\NestedRadioTag.java | 37

    public class NestedNotEmptyTag extends NotEmptyTag implements NestedNameSupport {
        /* the usual private member variables */
        private String originalName = null;
        private String originalProperty = null;

        /**
         * Overriding method of the heart of the matter. Gets the relative
         * property and leaves the rest up to the original tag implementation.
         * Sweet.
         *
         * @return int JSP continuation directive. This is in the hands of the
         *         super class.
         */
        public int doStartTag() throws JspException {
            // get the original properties
            originalName = getName();
            originalProperty = getProperty();

            // request
            HttpServletRequest request =
                (HttpServletRequest) pageContext.getRequest();

            // set the properties
            NestedPropertyHelper.setNestedProperties(request, this);

            // let the super do it's thing
            return super.doStartTag();
        }

        /**
         * Complete the processing of the tag. The nested tags here will restore
         * all the original value for the tag itself and the nesting context.
         *
         * @return int to describe the next step for the JSP processor
         * @throws JspException for the bad things JSP's do
         */
        public int doEndTag() throws JspException {
            // do the super's ending part
            int i = super.doEndTag();

            // reset the properties
            setName(originalName);
            setProperty(originalProperty);

            // continue
            return i;
        }

        /**
         * Release the tag's resources and reset the values.
         */
        public void release() {
            super.release();

            // reset the originals
            originalName = null;
            originalProperty = null;
        }
    }

File | Line
--- | ---
org\apache\struts\taglib\nested\html\NestedMessagesTag.java | 38
org\apache\struts\taglib\nested\logic\NestedMessagesNotPresentTag.java | 38

        implements NestedPropertySupport {
        /* the usual private member variables */
        private String originalName = null;
        private String originalProperty = null;

        /**
         * Overriding method of the heart of the matter. Gets the relative
         * property and leaves the rest up to the original tag implementation.
         * Sweet.
         *
         * @return int JSP continuation directive. This is in the hands of the
         *         super class.
         */
        public int doStartTag() throws JspException {
            // get the original properties
            originalName = getName();
            originalProperty = getProperty();

            // request
            HttpServletRequest request =
                (HttpServletRequest) pageContext.getRequest();

            // set the properties
            NestedPropertyHelper.setNestedProperties(request, this);

            // let the super do it's thing
            return super.doStartTag();
        }

        /**
         * Complete the processing of the tag. The nested tags here will restore
         * all the original value for the tag itself and the nesting context.
         *
         * @return int to describe the next step for the JSP processor
         * @throws JspException for the bad things JSP's do
         */
        public int doEndTag() throws JspException {
            // do the super's ending part
            int i = super.doEndTag();

            // reset the properties
            setName(originalName);
            setProperty(originalProperty);

            // continue
            return i;
        }

        /**
         * Release the tag's resources and reset the values.
         */
        public void release() {
            super.release();

            // reset the originals
            originalName = null;
            originalProperty = null;
        }
    }

File | Line
--- | ---
org\apache\struts\taglib\nested\html\NestedFileTag.java | 36
org\apache\struts\taglib\nested\html\NestedMultiboxTag.java | 37

    public class NestedMultiboxTag extends MultiboxTag implements NestedNameSupport {
        /* the usual private member variables */
        private String originalName = null;
        private String originalProperty = null;

        /**
         * Overriding method of the heart of the matter. Gets the relative
         * property and leaves the rest up to the original tag implementation.
         * Sweet.
         *
         * @return int JSP continuation directive. This is in the hands of the
         *         super class.
         */
        public int doStartTag() throws JspException {
            // get the original properties
            originalName = getName();
            originalProperty = getProperty();

            // request
            HttpServletRequest request =
                (HttpServletRequest) pageContext.getRequest();

            // set the properties
            NestedPropertyHelper.setNestedProperties(request, this);

            // let the super do it's thing
            return super.doStartTag();
        }

        /**
         * Complete the processing of the tag. The nested tags here will restore
         * all the original value for the tag itself and the nesting context.
         *
         * @return int to describe the next step for the JSP processor
         * @throws JspException for the bad things JSP's do
         */
        public int doEndTag() throws JspException {
            // do the super's ending part
            int i = super.doEndTag();

            // reset the properties
            setName(originalName);
            setProperty(originalProperty);

            // continue
            return i;
        }

        /**
         * Release the tag's resources and reset the values.
         */
        public void release() {
            super.release();

            // reset the originals
            originalName = null;
            originalProperty = null;
        }
    }

File | Line
--- | ---
org\apache\struts\taglib\nested\html\NestedErrorsTag.java | 37
org\apache\struts\taglib\nested\logic\NestedMessagesNotPresentTag.java | 38

        implements NestedPropertySupport {
        /* the usual private member variables */
        private String originalName = null;
        private String originalProperty = null;

        /**
         * Overriding method of the heart of the matter. Gets the relative
         * property and leaves the rest up to the original tag implementation.
         * Sweet.
         *
         * @return int JSP continuation directive. This is in the hands of the
         *         super class.
         */
        public int doStartTag() throws JspException {
            // get the original properties
            originalName = getName();
            originalProperty = getProperty();

            // request
            HttpServletRequest request =
                (HttpServletRequest) pageContext.getRequest();

            // set the properties
            NestedPropertyHelper.setNestedProperties(request, this);

            // let the super do it's thing
            return super.doStartTag();
        }

        /**
         * Complete the processing of the tag. The nested tags here will restore
         * all the original value for the tag itself and the nesting context.
         *
         * @return int to describe the next step for the JSP processor
         * @throws JspException for the bad things JSP's do
         */
        public int doEndTag() throws JspException {
            // do the super's ending part
            int i = super.doEndTag();

            // reset the properties
            setName(originalName);
            setProperty(originalProperty);

            // continue
            return i;
        }

        /**
         * Release the tag's resources and reset the values.
         */
        public void release() {
            super.release();

            // reset the originals
            originalName = null;
            originalProperty = null;
        }
    }

File | Line
--- | ---
org\apache\struts\taglib\nested\bean\NestedDefineTag.java | 37
org\apache\struts\taglib\nested\logic\NestedNotEmptyTag.java | 37

    public class NestedFileTag extends FileTag implements NestedNameSupport {
        /* the usual private member variables */
        private String originalName = null;
        private String originalProperty = null;

        /**
         * Overriding method of the heart of the matter. Gets the relative
         * property and leaves the rest up to the original tag implementation.
         * Sweet.
         *
         * @return int JSP continuation directive. This is in the hands of the
         *         super class.
         */
        public int doStartTag() throws JspException {
            // get the original properties
            originalName = getName();
            originalProperty = getProperty();

            // request
            HttpServletRequest request =
                (HttpServletRequest) pageContext.getRequest();

            // set the properties
            NestedPropertyHelper.setNestedProperties(request, this);

            // let the super do it's thing
            return super.doStartTag();
        }

        /**
         * Complete the processing of the tag. The nested tags here will restore
         * all the original value for the tag itself and the nesting context.
         *
         * @return int to describe the next step for the JSP processor
         * @throws JspException for the bad things JSP's do
         */
        public int doEndTag() throws JspException {
            // do the super's ending part
            int i = super.doEndTag();

            // reset the properties
            setName(originalName);
            setProperty(originalProperty);

            // continue
            return i;
        }

        /**
         * Release the tag's resources and reset the values.
         */
        public void release() {
            super.release();

            // reset the originals
            originalName = null;
            originalProperty = null;
        }
    }

File | Line
--- | ---
org\apache\struts\taglib\nested\bean\NestedDefineTag.java | 37
org\apache\struts\taglib\nested\html\NestedMessagesTag.java | 38

    public class NestedErrorsTag extends ErrorsTag implements NestedPropertySupport {
        /* the usual private member variables */
        private String originalName = null;
        private String originalProperty = null;

        /**
         * Overriding method of the heart of the matter. Gets the relative
         * property and leaves the rest up to the original tag implementation.
         * Sweet.
         *
         * @return int JSP continuation directive. This is in the hands of the
         *         super class.
         */
        public int doStartTag() throws JspException {
            // get the original properties
            originalName = getName();
            originalProperty = getProperty();

            // request
            HttpServletRequest request =
                (HttpServletRequest) pageContext.getRequest();

            // set the properties
            NestedPropertyHelper.setNestedProperties(request, this);

            // let the super do it's thing
            return super.doStartTag();
        }

        /**
         * Complete the processing of the tag. The nested tags here will restore
         * all the original value for the tag itself and the nesting context.
         *
         * @return int to describe the next step for the JSP processor
         * @throws JspException for the bad things JSP's do
         */
        public int doEndTag() throws JspException {
            // do the super's ending part
            int i = super.doEndTag();

            // reset the properties
            setName(originalName);
            setProperty(originalProperty);

            // continue
            return i;
        }

        /**
         * Release the tag's resources and reset the values.
         */
        public void release() {
            super.release();

            // reset the originals
            originalName = null;
            originalProperty = null;
        }
    }