• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

hazendaz / displaytag / 1753

12 Feb 2026 03:17AM UTC coverage: 77.321% (-0.01%) from 77.334%
1753

push

github

web-flow
Merge pull request #1102 from hazendaz/renovate/javax-support-logback-monorepo

Update dependency ch.qos.logback:logback-classic to v1.5.29 (javax-support)

1438 of 2003 branches covered (71.79%)

Branch coverage included in aggregate %.

4034 of 5074 relevant lines covered (79.5%)

0.8 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

87.88
/displaytag/src/main/java/org/displaytag/tags/SetPropertyTag.java
1
/*
2
 * SPDX-License-Identifier: MIT
3
 * See LICENSE file for details.
4
 *
5
 * Copyright 2002-2026 Fabrizio Giustina, the Displaytag team
6
 */
7
package org.displaytag.tags;
8

9
import javax.servlet.jsp.JspException;
10
import javax.servlet.jsp.tagext.BodyTagSupport;
11
import javax.servlet.jsp.tagext.Tag;
12
import javax.servlet.jsp.tagext.TagSupport;
13

14
import org.displaytag.exception.MissingAttributeException;
15
import org.displaytag.exception.TagStructureException;
16

17
/**
18
 * The Class SetPropertyTag.
19
 */
20
public class SetPropertyTag extends BodyTagSupport {
1✔
21

22
    /**
23
     * Serial ID.
24
     */
25
    private static final long serialVersionUID = 899149338534L;
26

27
    /**
28
     * property name.
29
     */
30
    private String name;
31

32
    /**
33
     * property value.
34
     */
35
    private String value;
36

37
    /** is this the first iteration?. */
38
    private boolean firstIteration;
39

40
    /**
41
     * Sets the name of the property.
42
     *
43
     * @param propertyName
44
     *            String
45
     */
46
    public void setName(final String propertyName) {
47
        this.name = propertyName;
1✔
48
    }
1✔
49

50
    /**
51
     * Sets the value of the property.
52
     *
53
     * @param propertyValue
54
     *            String
55
     */
56
    public void setValue(final String propertyValue) {
57
        this.value = propertyValue;
1✔
58
    }
1✔
59

60
    /**
61
     * Do start tag.
62
     *
63
     * @return the int
64
     *
65
     * @throws JspException
66
     *             the jsp exception
67
     *
68
     * @see javax.servlet.jsp.tagext.Tag#doStartTag()
69
     */
70
    @Override
71
    public int doStartTag() throws JspException {
72
        final TableTag tableTag = (TableTag) TagSupport.findAncestorWithClass(this, TableTag.class);
1✔
73

74
        if (tableTag == null) {
1!
75
            throw new TagStructureException(this.getClass(), "setProperty", "table"); //$NON-NLS-1$ //$NON-NLS-2$
×
76
        }
77

78
        // read body only once
79
        if (tableTag.isFirstIteration()) {
1✔
80
            this.firstIteration = true;
1✔
81
            // using int to avoid deprecation error in compilation using j2ee 1.3 (EVAL_BODY_TAG)
82
            return 2;
1✔
83
        }
84

85
        this.firstIteration = false;
1✔
86
        return Tag.SKIP_BODY;
1✔
87

88
    }
89

90
    /**
91
     * Passes attribute information up to the parent TableTag.
92
     * <p>
93
     * When we hit the end of the tag, we simply let our parent (which better be a TableTag) know what the user wants to
94
     * change a property value, and we pass the name/value pair that the user gave us, up to the parent
95
     * </p>
96
     *
97
     * @return <code>TagSupport.EVAL_PAGE</code>
98
     *
99
     * @throws MissingAttributeException
100
     *             if no value or body content has been set
101
     *
102
     * @see javax.servlet.jsp.tagext.Tag#doEndTag()
103
     */
104
    @Override
105
    public int doEndTag() throws MissingAttributeException {
106

107
        if (this.firstIteration) {
1✔
108
            final TableTag tableTag = (TableTag) TagSupport.findAncestorWithClass(this, TableTag.class);
1✔
109

110
            // tableTag can't be null, it has been checked in doStartTag
111
            if (this.value == null) {
1✔
112
                if (this.getBodyContent() == null) {
1!
113
                    throw new MissingAttributeException(this.getClass(), //
×
114
                            new String[] { "value", "body content" }); //$NON-NLS-1$ //$NON-NLS-2$
115
                }
116
                this.value = this.getBodyContent().getString();
1✔
117
            }
118

119
            tableTag.setProperty(this.name, this.value);
1✔
120

121
            this.name = null;
1✔
122
            this.value = null;
1✔
123
        }
124
        return Tag.EVAL_PAGE;
1✔
125
    }
126

127
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc