View | Details | Raw Unified | Return to bug 50279
Collapse All | Expand All

(-)src/test/java/org/apache/taglibs/standard/VersionTest.java (-2 / +2 lines)
Lines 17-26 Link Here
17
17
18
package org.apache.taglibs.standard;
18
package org.apache.taglibs.standard;
19
19
20
import junit.framework.*;
20
import junit.framework.TestCase;
21
21
22
public class VersionTest
22
public class VersionTest
23
    extends TestCase {
23
        extends TestCase {
24
    private Version version = null;
24
    private Version version = null;
25
25
26
    public VersionTest(String name) {
26
    public VersionTest(String name) {
(-)src/test/java/org/apache/taglibs/standard/functions/FunctionsTest.java (-8 / +18 lines)
Lines 16-30 Link Here
16
 */
16
 */
17
package org.apache.taglibs.standard.functions;
17
package org.apache.taglibs.standard.functions;
18
18
19
import java.util.Arrays;
20
import java.util.Collections;
21
22
import javax.servlet.jsp.JspTagException;
23
19
import org.apache.taglibs.standard.resources.Resources;
24
import org.apache.taglibs.standard.resources.Resources;
20
import org.junit.Assert;
25
import org.junit.Assert;
21
import org.junit.Test;
26
import org.junit.Test;
22
27
23
import javax.servlet.jsp.JspTagException;
28
import static org.apache.taglibs.standard.functions.Functions.endsWith;
24
import java.util.Arrays;
29
import static org.apache.taglibs.standard.functions.Functions.escapeXml;
25
import java.util.Collections;
30
import static org.apache.taglibs.standard.functions.Functions.join;
31
import static org.apache.taglibs.standard.functions.Functions.length;
32
import static org.apache.taglibs.standard.functions.Functions.replace;
33
import static org.apache.taglibs.standard.functions.Functions.split;
34
import static org.apache.taglibs.standard.functions.Functions.substring;
35
import static org.apache.taglibs.standard.functions.Functions.substringAfter;
36
import static org.apache.taglibs.standard.functions.Functions.substringBefore;
26
37
27
import static org.apache.taglibs.standard.functions.Functions.*;
28
/**
38
/**
29
 */
39
 */
30
public class FunctionsTest {
40
public class FunctionsTest {
Lines 104-113 Link Here
104
    public void testLength() throws Exception {
114
    public void testLength() throws Exception {
105
        Assert.assertEquals(0, length(null));
115
        Assert.assertEquals(0, length(null));
106
        Assert.assertEquals(0, length(""));
116
        Assert.assertEquals(0, length(""));
107
        Assert.assertEquals(3, length(new int[]{1,2,3}));
117
        Assert.assertEquals(3, length(new int[]{1, 2, 3}));
108
        Assert.assertEquals(3, length(Arrays.asList(1,2,3)));
118
        Assert.assertEquals(3, length(Arrays.asList(1, 2, 3)));
109
        Assert.assertEquals(3, length(Arrays.asList(1,2,3).iterator()));
119
        Assert.assertEquals(3, length(Arrays.asList(1, 2, 3).iterator()));
110
        Assert.assertEquals(3, length(Collections.enumeration(Arrays.asList(1,2,3))));
120
        Assert.assertEquals(3, length(Collections.enumeration(Arrays.asList(1, 2, 3))));
111
        Assert.assertEquals(1, length(Collections.singletonMap("Hello", "World")));
121
        Assert.assertEquals(1, length(Collections.singletonMap("Hello", "World")));
112
        try {
122
        try {
113
            length(3);
123
            length(3);
(-)src/test/java/org/apache/taglibs/standard/tag/common/fmt/BundleSupportTest.java (+1 lines)
Lines 36-41 Link Here
36
    }
36
    }
37
37
38
    // test for bugzilla #49900 that bodyContent is not released
38
    // test for bugzilla #49900 that bodyContent is not released
39
39
    @Test
40
    @Test
40
    public void testBodyContentIsRelease() {
41
    public void testBodyContentIsRelease() {
41
        BodyContent b = EasyMock.createMock(BodyContent.class);
42
        BodyContent b = EasyMock.createMock(BodyContent.class);
(-)src/test/java/org/apache/taglibs/standard/tag/common/core/SetSupportTest.java (-6 / +6 lines)
Lines 16-26 Link Here
16
 */
16
 */
17
package org.apache.taglibs.standard.tag.common.core;
17
package org.apache.taglibs.standard.tag.common.core;
18
18
19
import org.apache.taglibs.standard.resources.Resources;
19
import java.util.Map;
20
import org.junit.After;
21
import org.junit.Assert;
22
import org.junit.Before;
23
import org.junit.Test;
24
20
25
import javax.el.ELContext;
21
import javax.el.ELContext;
26
import javax.el.ExpressionFactory;
22
import javax.el.ExpressionFactory;
Lines 33-39 Link Here
33
import javax.servlet.jsp.PageContext;
29
import javax.servlet.jsp.PageContext;
34
import javax.servlet.jsp.tagext.BodyContent;
30
import javax.servlet.jsp.tagext.BodyContent;
35
31
36
import java.util.Map;
32
import org.apache.taglibs.standard.resources.Resources;
33
import org.junit.After;
34
import org.junit.Assert;
35
import org.junit.Before;
36
import org.junit.Test;
37
37
38
import static org.easymock.EasyMock.createMock;
38
import static org.easymock.EasyMock.createMock;
39
import static org.easymock.EasyMock.expect;
39
import static org.easymock.EasyMock.expect;
(-)src/test/java/org/apache/taglibs/standard/util/EscapeXMLTest.java (-7 / +8 lines)
Lines 16-32 Link Here
16
 */
16
 */
17
package org.apache.taglibs.standard.util;
17
package org.apache.taglibs.standard.util;
18
18
19
import java.io.IOException;
20
import java.io.Reader;
21
import java.io.StringReader;
22
23
import javax.servlet.jsp.JspWriter;
24
19
import org.junit.Assert;
25
import org.junit.Assert;
20
import org.junit.Before;
26
import org.junit.Before;
21
import org.junit.Test;
27
import org.junit.Test;
22
28
23
import javax.servlet.jsp.JspWriter;
29
import static org.apache.taglibs.standard.util.EscapeXML.emit;
24
30
import static org.apache.taglibs.standard.util.EscapeXML.escape;
25
import java.io.IOException;
26
import java.io.Reader;
27
import java.io.StringReader;
28
29
import static org.apache.taglibs.standard.util.EscapeXML.*;
30
import static org.easymock.EasyMock.createMock;
31
import static org.easymock.EasyMock.createMock;
31
import static org.easymock.EasyMock.eq;
32
import static org.easymock.EasyMock.eq;
32
import static org.easymock.EasyMock.expect;
33
import static org.easymock.EasyMock.expect;
(-)src/main/java/org/apache/taglibs/standard/tei/DeclareTEI.java (-7 / +8 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tei;
18
package org.apache.taglibs.standard.tei;
19
19
Lines 33-47 Link Here
33
public class DeclareTEI extends TagExtraInfo {
33
public class DeclareTEI extends TagExtraInfo {
34
34
35
    // purposely inherit JavaDoc and semantics from TagExtraInfo
35
    // purposely inherit JavaDoc and semantics from TagExtraInfo
36
36
    @Override
37
    @Override
37
    public VariableInfo[] getVariableInfo(TagData data) {
38
    public VariableInfo[] getVariableInfo(TagData data) {
38
        // construct the relevant VariableInfo object
39
        // construct the relevant VariableInfo object
39
        VariableInfo id = new VariableInfo(
40
        VariableInfo id = new VariableInfo(
40
            data.getAttributeString("id"),
41
                data.getAttributeString("id"),
41
            data.getAttributeString("type") == null ?
42
                data.getAttributeString("type") == null ?
42
		"java.lang.Object" : data.getAttributeString("type"),
43
                        "java.lang.Object" : data.getAttributeString("type"),
43
            true,
44
                true,
44
            VariableInfo.AT_END);
45
                VariableInfo.AT_END);
45
        return new VariableInfo[] { id };
46
        return new VariableInfo[]{id};
46
    }
47
    }
47
}
48
}
(-)src/main/java/org/apache/taglibs/standard/tei/ForEachTEI.java (-3 / +6 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tei;
18
package org.apache.taglibs.standard.tei;
19
19
Lines 37-47 Link Here
37
     * 
37
     * 
38
     * - If 'items' is not specified, 'begin' and 'end' must be
38
     * - If 'items' is not specified, 'begin' and 'end' must be
39
     */
39
     */
40
40
    @Override
41
    @Override
41
    public boolean isValid(TagData us) {
42
    public boolean isValid(TagData us) {
42
        if (!Util.isSpecified(us, ITEMS))
43
        if (!Util.isSpecified(us, ITEMS)) {
43
            if (!Util.isSpecified(us, BEGIN) || !(Util.isSpecified(us, END)))
44
            if (!Util.isSpecified(us, BEGIN) || !(Util.isSpecified(us, END))) {
44
                return false;
45
                return false;
46
            }
47
        }
45
        return true;
48
        return true;
46
    }
49
    }
47
50
(-)src/main/java/org/apache/taglibs/standard/tei/ImportTEI.java (-4 / +5 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tei;
18
package org.apache.taglibs.standard.tei;
19
19
Lines 33-41 Link Here
33
33
34
    @Override
34
    @Override
35
    public boolean isValid(TagData us) {
35
    public boolean isValid(TagData us) {
36
	// don't allow both VAR and VAR_READER, together
36
        // don't allow both VAR and VAR_READER, together
37
	if (Util.isSpecified(us, VAR) && Util.isSpecified(us, VAR_READER))
37
        if (Util.isSpecified(us, VAR) && Util.isSpecified(us, VAR_READER)) {
38
	    return false;
38
            return false;
39
        }
39
40
40
        return true;
41
        return true;
41
    }
42
    }
(-)src/main/java/org/apache/taglibs/standard/tei/Util.java (-1 / +1 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tei;
18
package org.apache.taglibs.standard.tei;
19
19
(-)src/main/java/org/apache/taglibs/standard/tei/XmlParseTEI.java (-12 / +16 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tei;
18
package org.apache.taglibs.standard.tei;
19
19
Lines 35-53 Link Here
35
35
36
    @Override
36
    @Override
37
    public boolean isValid(TagData us) {
37
    public boolean isValid(TagData us) {
38
	// must have no more than one of VAR and VAR_DOM ...
38
        // must have no more than one of VAR and VAR_DOM ...
39
	if (Util.isSpecified(us, VAR) && Util.isSpecified(us, VAR_DOM))
39
        if (Util.isSpecified(us, VAR) && Util.isSpecified(us, VAR_DOM)) {
40
	    return false;
40
            return false;
41
        }
41
42
42
	// ... and must have no less than one of VAR and VAR_DOM
43
        // ... and must have no less than one of VAR and VAR_DOM
43
	if (!(Util.isSpecified(us, VAR) || Util.isSpecified(us, VAR_DOM)))
44
        if (!(Util.isSpecified(us, VAR) || Util.isSpecified(us, VAR_DOM))) {
44
	    return false;
45
            return false;
46
        }
45
47
46
	// When either 'scope' is specified, its 'var' must be specified
48
        // When either 'scope' is specified, its 'var' must be specified
47
	if (Util.isSpecified(us, SCOPE) && !Util.isSpecified(us, VAR))
49
        if (Util.isSpecified(us, SCOPE) && !Util.isSpecified(us, VAR)) {
48
	    return false;
50
            return false;
49
	if (Util.isSpecified(us, SCOPE_DOM) && !Util.isSpecified(us, VAR_DOM))
51
        }
50
	    return false;
52
        if (Util.isSpecified(us, SCOPE_DOM) && !Util.isSpecified(us, VAR_DOM)) {
53
            return false;
54
        }
51
55
52
        return true;
56
        return true;
53
    }
57
    }
(-)src/main/java/org/apache/taglibs/standard/tei/XmlTransformTEI.java (-7 / +9 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tei;
18
package org.apache.taglibs.standard.tei;
19
19
Lines 34-46 Link Here
34
34
35
    @Override
35
    @Override
36
    public boolean isValid(TagData us) {
36
    public boolean isValid(TagData us) {
37
	// require XSLT
37
        // require XSLT
38
	if (!Util.isSpecified(us, XSLT))
38
        if (!Util.isSpecified(us, XSLT)) {
39
	    return false;
39
            return false;
40
        }
40
41
41
	// disallow both VAR and RESULT
42
        // disallow both VAR and RESULT
42
	if (Util.isSpecified(us, VAR) && Util.isSpecified(us, RESULT))
43
        if (Util.isSpecified(us, VAR) && Util.isSpecified(us, RESULT)) {
43
	    return false;
44
            return false;
45
        }
44
        return true;
46
        return true;
45
    }
47
    }
46
48
(-)src/main/java/org/apache/taglibs/standard/Version.java (-99 / +91 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard;
18
package org.apache.taglibs.standard;
19
19
Lines 23-131 Link Here
23
 * Administrative class to keep track of the version number of
23
 * Administrative class to keep track of the version number of
24
 * the standard tag library.
24
 * the standard tag library.
25
 * <P>This class implements the upcoming standard of having
25
 * <P>This class implements the upcoming standard of having
26
 * org.apache.project-name.Version.getVersion() be a standard way 
26
 * org.apache.project-name.Version.getVersion() be a standard way
27
 * to get version information.  
27
 * to get version information.
28
 */
28
 */
29
public class Version
29
public class Version {
30
{
30
    /**
31
  /**
31
     * Get the basic version string for the current release.
32
   * Get the basic version string for the current release.
32
     * Version String formatted like
33
   * Version String formatted like 
33
     * <CODE>"<B>standard-taglib</B> v.r[.dd| <B>D</B>nn]"</CODE>.
34
   * <CODE>"<B>standard-taglib</B> v.r[.dd| <B>D</B>nn]"</CODE>.
34
     * <p/>
35
   *
35
     * Futurework: have this read version info from jar manifest.
36
   * Futurework: have this read version info from jar manifest.
36
     *
37
   *
37
     * @return String denoting our current version
38
   * @return String denoting our current version
38
     */
39
   */
39
    public static String getVersion() {
40
  public static String getVersion()
40
        return getProduct() + " " +
41
  {
41
                getMajorVersionNum() + "." + getReleaseVersionNum() + "." +
42
    return getProduct() + " " +
42
                getMaintenanceVersionNum() +
43
           getMajorVersionNum() + "." + getReleaseVersionNum()+ "." +
43
                ((getDevelopmentVersionNum() > 0) ?
44
           getMaintenanceVersionNum() +
44
                        ("_D" + getDevelopmentVersionNum()) : "");
45
           ((getDevelopmentVersionNum() > 0) ? 
45
    }
46
               ("_D" + getDevelopmentVersionNum()) : "");
47
  }
48
46
49
  /**
47
    /**
50
   * Print the processor version to the command line.
48
     * Print the processor version to the command line.
51
   *
49
     *
52
   * @param argv command line arguments, unused.
50
     * @param argv command line arguments, unused.
53
   */
51
     */
54
  public static void main(String argv[])
52
    public static void main(String argv[]) {
55
  {
53
        System.out.println(getVersion());
56
    System.out.println(getVersion());
54
    }
57
  }
58
55
59
  /**
56
    /**
60
   * Name of product
57
     * Name of product
61
   */
58
     */
62
  public static String getProduct()
59
    public static String getProduct() {
63
  {
60
        return "standard-taglib";
64
    return "standard-taglib";
61
    }
65
  }
66
62
67
  /**
63
    /**
68
   * Major version number.
64
     * Major version number.
69
   * Version number. This changes only when there is a
65
     * Version number. This changes only when there is a
70
   *          significant, externally apparent enhancement from
66
     * significant, externally apparent enhancement from
71
   *          the previous release. 'n' represents the n'th
67
     * the previous release. 'n' represents the n'th
72
   *          version.
68
     * version.
73
   *
69
     * <p/>
74
   *          Clients should carefully consider the implications
70
     * Clients should carefully consider the implications
75
   *          of new versions as external interfaces and behaviour
71
     * of new versions as external interfaces and behaviour
76
   *          may have changed.
72
     * may have changed.
77
   */
73
     */
78
  public static int getMajorVersionNum()
74
    public static int getMajorVersionNum() {
79
  {
75
        return 1;
80
      return 1;
76
    }
81
  }
82
77
83
  /**
78
    /**
84
   * Release Number.
79
     * Release Number.
85
   * Release number. This changes when:
80
     * Release number. This changes when:
86
   *            -  a new set of functionality is to be added, eg,
81
     * -  a new set of functionality is to be added, eg,
87
   *               implementation of a new W3C specification.
82
     * implementation of a new W3C specification.
88
   *            -  API or behaviour change.
83
     * -  API or behaviour change.
89
   *            -  its designated as a reference release.
84
     * -  its designated as a reference release.
90
   */
85
     */
91
  public static int getReleaseVersionNum()
86
    public static int getReleaseVersionNum() {
92
  {
87
        return 2;
93
    return 2;
88
    }
94
  }
95
89
96
  /**
90
    /**
97
   * Maintenance Drop Number.
91
     * Maintenance Drop Number.
98
   * Optional identifier used to designate maintenance
92
     * Optional identifier used to designate maintenance
99
   *          drop applied to a specific release and contains
93
     * drop applied to a specific release and contains
100
   *          fixes for defects reported. It maintains compatibility
94
     * fixes for defects reported. It maintains compatibility
101
   *          with the release and contains no API changes.
95
     * with the release and contains no API changes.
102
   *          When missing, it designates the final and complete
96
     * When missing, it designates the final and complete
103
   *          development drop for a release.
97
     * development drop for a release.
104
   */
98
     */
105
  public static int getMaintenanceVersionNum()
99
    public static int getMaintenanceVersionNum() {
106
  {
100
        return 0;
107
    return 0;
101
    }
108
  }
109
102
110
  /**
103
    /**
111
   * Development Drop Number.
104
     * Development Drop Number.
112
   * Optional identifier designates development drop of
105
     * Optional identifier designates development drop of
113
   *          a specific release. D01 is the first development drop
106
     * a specific release. D01 is the first development drop
114
   *          of a new release.
107
     * of a new release.
115
   *
108
     * <p/>
116
   *          Development drops are works in progress towards a
109
     * Development drops are works in progress towards a
117
   *          compeleted, final release. A specific development drop
110
     * compeleted, final release. A specific development drop
118
   *          may not completely implement all aspects of a new
111
     * may not completely implement all aspects of a new
119
   *          feature, which may take several development drops to
112
     * feature, which may take several development drops to
120
   *          complete. At the point of the final drop for the
113
     * complete. At the point of the final drop for the
121
   *          release, the D suffix will be omitted.
114
     * release, the D suffix will be omitted.
122
   *
115
     * <p/>
123
   *          Each 'D' drops can contain functional enhancements as
116
     * Each 'D' drops can contain functional enhancements as
124
   *          well as defect fixes. 'D' drops may not be as stable as
117
     * well as defect fixes. 'D' drops may not be as stable as
125
   *          the final releases.
118
     * the final releases.
126
   */
119
     */
127
  public static int getDevelopmentVersionNum()
120
    public static int getDevelopmentVersionNum() {
128
  {
121
        return 0;
129
    return 0;
122
    }
130
  }
131
}
123
}
(-)src/main/java/org/apache/taglibs/standard/tlv/JstlSqlTLV.java (-86 / +101 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tlv;
18
package org.apache.taglibs.standard.tlv;
19
19
Lines 29-35 Link Here
29
29
30
/**
30
/**
31
 * <p>A SAX-based TagLibraryValidator for the JSTL SQL tag library.
31
 * <p>A SAX-based TagLibraryValidator for the JSTL SQL tag library.
32
 * 
32
 *
33
 * @author Shawn Bayern
33
 * @author Shawn Bayern
34
 */
34
 */
35
public class JstlSqlTLV extends JstlBaseTLV {
35
public class JstlSqlTLV extends JstlBaseTLV {
Lines 54-63 Link Here
54
54
55
    //*********************************************************************
55
    //*********************************************************************
56
    // set its type and delegate validation to super-class
56
    // set its type and delegate validation to super-class
57
57
    @Override
58
    @Override
58
    public  ValidationMessage[] validate(
59
    public ValidationMessage[] validate(
59
	    String prefix, String uri, PageData page) {
60
            String prefix, String uri, PageData page) {
60
	return super.validate( TYPE_SQL, prefix, uri, page );
61
        return super.validate(TYPE_SQL, prefix, uri, page);
61
    }
62
    }
62
63
63
64
Lines 66-137 Link Here
66
67
67
    @Override
68
    @Override
68
    protected DefaultHandler getHandler() {
69
    protected DefaultHandler getHandler() {
69
	return new Handler();
70
        return new Handler();
70
    }
71
    }
71
72
72
73
73
    //*********************************************************************
74
    //*********************************************************************
74
    // SAX event handler
75
    // SAX event handler
75
76
76
    /** The handler that provides the base of our implementation. */
77
    /**
78
     * The handler that provides the base of our implementation.
79
     */
77
    private class Handler extends DefaultHandler {
80
    private class Handler extends DefaultHandler {
78
81
79
	// parser state
82
        // parser state
80
	private int depth = 0;
83
        private int depth = 0;
81
        private Stack queryDepths = new Stack();
84
        private Stack queryDepths = new Stack();
82
        private Stack updateDepths = new Stack();
85
        private Stack updateDepths = new Stack();
83
        private Stack transactionDepths = new Stack();
86
        private Stack transactionDepths = new Stack();
84
	private String lastElementName = null;
87
        private String lastElementName = null;
85
	private boolean bodyNecessary = false;
88
        private boolean bodyNecessary = false;
86
	private boolean bodyIllegal = false;
89
        private boolean bodyIllegal = false;
87
90
88
	// process under the existing context (state), then modify it
91
        // process under the existing context (state), then modify it
89
	@Override
90
    public void startElement(
91
	        String ns, String ln, String qn, Attributes a) {
92
92
93
	    // substitute our own parsed 'ln' if it's not provided
93
        @Override
94
	    if (ln == null)
94
        public void startElement(
95
		ln = getLocalPart(qn);
95
                String ns, String ln, String qn, Attributes a) {
96
96
97
	    // for simplicity, we can ignore <jsp:text> for our purposes
97
            // substitute our own parsed 'ln' if it's not provided
98
	    // (don't bother distinguishing between it and its characters)
98
            if (ln == null) {
99
	    if (qn.equals(JSP_TEXT))
99
                ln = getLocalPart(qn);
100
		return;
100
            }
101
101
102
	    // check body-related constraint
102
            // for simplicity, we can ignore <jsp:text> for our purposes
103
	    if (bodyIllegal)
103
            // (don't bother distinguishing between it and its characters)
104
		fail(Resources.getMessage("TLV_ILLEGAL_BODY", lastElementName));
104
            if (qn.equals(JSP_TEXT)) {
105
                return;
106
            }
105
107
106
	    // validate expression syntax if we need to
108
            // check body-related constraint
107
	    Set expAtts;
109
            if (bodyIllegal) {
108
	    if (qn.startsWith(prefix + ":")
110
                fail(Resources.getMessage("TLV_ILLEGAL_BODY", lastElementName));
109
		    && (expAtts = (Set) config.get(ln)) != null) {
111
            }
110
		for (int i = 0; i < a.getLength(); i++) {
111
		    String attName = a.getLocalName(i);
112
		    if (expAtts.contains(attName)) {
113
			String vMsg =
114
			    validateExpression(
115
				ln,
116
				attName,
117
				a.getValue(i));
118
			if (vMsg != null)
119
			    fail(vMsg);
120
		    }
121
		}
122
	    }
123
112
113
            // validate expression syntax if we need to
114
            Set expAtts;
115
            if (qn.startsWith(prefix + ":")
116
                    && (expAtts = (Set) config.get(ln)) != null) {
117
                for (int i = 0; i < a.getLength(); i++) {
118
                    String attName = a.getLocalName(i);
119
                    if (expAtts.contains(attName)) {
120
                        String vMsg =
121
                                validateExpression(
122
                                        ln,
123
                                        attName,
124
                                        a.getValue(i));
125
                        if (vMsg != null) {
126
                            fail(vMsg);
127
                        }
128
                    }
129
                }
130
            }
131
124
            // validate attributes
132
            // validate attributes
125
            if (qn.startsWith(prefix + ":") && !hasNoInvalidScope(a))
133
            if (qn.startsWith(prefix + ":") && !hasNoInvalidScope(a)) {
126
                fail(Resources.getMessage("TLV_INVALID_ATTRIBUTE",
134
                fail(Resources.getMessage("TLV_INVALID_ATTRIBUTE",
127
                    SCOPE, qn, a.getValue(SCOPE))); 
135
                        SCOPE, qn, a.getValue(SCOPE)));
128
	    if (qn.startsWith(prefix + ":") && hasEmptyVar(a))
136
            }
129
		fail(Resources.getMessage("TLV_EMPTY_VAR", qn));
137
            if (qn.startsWith(prefix + ":") && hasEmptyVar(a)) {
130
	    if (qn.startsWith(prefix + ":") && hasDanglingScope(a) &&
138
                fail(Resources.getMessage("TLV_EMPTY_VAR", qn));
131
                !qn.startsWith(prefix + ":" + SETDATASOURCE))
139
            }
132
		fail(Resources.getMessage("TLV_DANGLING_SCOPE", qn));
140
            if (qn.startsWith(prefix + ":") && hasDanglingScope(a) &&
141
                    !qn.startsWith(prefix + ":" + SETDATASOURCE)) {
142
                fail(Resources.getMessage("TLV_DANGLING_SCOPE", qn));
143
            }
133
144
134
	    // now, modify state
145
            // now, modify state
135
146
136
            /*
147
            /*
137
             * Make sure <sql:param> is nested inside <sql:query> or
148
             * Make sure <sql:param> is nested inside <sql:query> or
Lines 145-152 Link Here
145
             *   </c:forEach>
156
             *   </c:forEach>
146
             *  </sql:query>
157
             *  </sql:query>
147
             */
158
             */
148
            if ( (isSqlTag(ns, ln, PARAM) || isSqlTag(ns, ln, DATEPARAM)) 
159
            if ((isSqlTag(ns, ln, PARAM) || isSqlTag(ns, ln, DATEPARAM))
149
                && (queryDepths.empty() && updateDepths.empty()) ) {
160
                    && (queryDepths.empty() && updateDepths.empty())) {
150
                fail(Resources.getMessage("SQL_PARAM_OUTSIDE_PARENT"));
161
                fail(Resources.getMessage("SQL_PARAM_OUTSIDE_PARENT"));
151
            }
162
            }
152
163
Lines 163-171 Link Here
163
                transactionDepths.push(new Integer(depth));
174
                transactionDepths.push(new Integer(depth));
164
            }
175
            }
165
176
166
	    // set up a check against illegal attribute/body combinations
177
            // set up a check against illegal attribute/body combinations
167
	    bodyIllegal = false;
178
            bodyIllegal = false;
168
	    bodyNecessary = false;
179
            bodyNecessary = false;
169
180
170
            if (isSqlTag(ns, ln, QUERY) || isSqlTag(ns, ln, UPDATE)) {
181
            if (isSqlTag(ns, ln, QUERY) || isSqlTag(ns, ln, UPDATE)) {
171
                if (!hasAttribute(a, SQL)) {
182
                if (!hasAttribute(a, SQL)) {
Lines 180-220 Link Here
180
                bodyIllegal = true;
191
                bodyIllegal = true;
181
            }
192
            }
182
193
183
	    // record the most recent tag (for error reporting)
194
            // record the most recent tag (for error reporting)
184
	    lastElementName = qn;
195
            lastElementName = qn;
185
	    lastElementId = a.getValue("http://java.sun.com/JSP/Page", "id");
196
            lastElementId = a.getValue("http://java.sun.com/JSP/Page", "id");
186
197
187
	    // we're a new element, so increase depth
198
            // we're a new element, so increase depth
188
	    depth++;
199
            depth++;
189
	}
200
        }
190
201
191
	@Override
202
        @Override
192
    public void characters(char[] ch, int start, int length) {
203
        public void characters(char[] ch, int start, int length) {
193
204
194
	    bodyNecessary = false;		// body is no longer necessary!
205
            bodyNecessary = false;        // body is no longer necessary!
195
206
196
	    // ignore strings that are just whitespace
207
            // ignore strings that are just whitespace
197
	    String s = new String(ch, start, length).trim();
208
            String s = new String(ch, start, length).trim();
198
	    if (s.equals(""))
209
            if (s.equals("")) {
199
		return;
210
                return;
211
            }
200
212
201
	    // check and update body-related constraints
213
            // check and update body-related constraints
202
	    if (bodyIllegal)
214
            if (bodyIllegal) {
203
		fail(Resources.getMessage("TLV_ILLEGAL_BODY", lastElementName));
215
                fail(Resources.getMessage("TLV_ILLEGAL_BODY", lastElementName));
204
	}
216
            }
217
        }
205
218
206
	@Override
219
        @Override
207
    public void endElement(String ns, String ln, String qn) {
220
        public void endElement(String ns, String ln, String qn) {
208
221
209
	    // consistently, we ignore JSP_TEXT
222
            // consistently, we ignore JSP_TEXT
210
	    if (qn.equals(JSP_TEXT))
223
            if (qn.equals(JSP_TEXT)) {
211
		return;
224
                return;
225
            }
212
226
213
	    // handle body-related invariant
227
            // handle body-related invariant
214
	    if (bodyNecessary)
228
            if (bodyNecessary) {
215
		fail(Resources.getMessage("TLV_MISSING_BODY",
229
                fail(Resources.getMessage("TLV_MISSING_BODY",
216
		    lastElementName));
230
                        lastElementName));
217
	    bodyIllegal = false;	// reset: we've left the tag
231
            }
232
            bodyIllegal = false;    // reset: we've left the tag
218
233
219
            // update <query>-related state
234
            // update <query>-related state
220
            if (isSqlTag(ns, ln, QUERY)) {
235
            if (isSqlTag(ns, ln, QUERY)) {
Lines 229-236 Link Here
229
                transactionDepths.pop();
244
                transactionDepths.pop();
230
            }
245
            }
231
246
232
	    // update our depth
247
            // update our depth
233
	    depth--;
248
            depth--;
234
	}
249
        }
235
    }
250
    }
236
}
251
}
(-)src/main/java/org/apache/taglibs/standard/tlv/JstlXmlTLV.java (-146 / +169 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tlv;
18
package org.apache.taglibs.standard.tlv;
19
19
Lines 30-44 Link Here
30
/**
30
/**
31
 * <p>A SAX-based TagLibraryValidator for the JSTL XML library.
31
 * <p>A SAX-based TagLibraryValidator for the JSTL XML library.
32
 * Currently implements the following checks:</p>
32
 * Currently implements the following checks:</p>
33
 * 
33
 * <p/>
34
 * <ul>
34
 * <ul>
35
 *   <li>Expression syntax validation.
35
 * <li>Expression syntax validation.
36
 *   <li>Choose / when / otherwise constraints</li>
36
 * <li>Choose / when / otherwise constraints</li>
37
 *   <li>Tag bodies that must either be empty or non-empty given
37
 * <li>Tag bodies that must either be empty or non-empty given
38
 *      particular attributes.</li>
38
 * particular attributes.</li>
39
 *   <li>Other minor constraints.</li>
39
 * <li>Other minor constraints.</li>
40
 * </ul>
40
 * </ul>
41
 * 
41
 *
42
 * @author Shawn Bayern
42
 * @author Shawn Bayern
43
 */
43
 */
44
public class JstlXmlTLV extends JstlBaseTLV {
44
public class JstlXmlTLV extends JstlBaseTLV {
Lines 87-96 Link Here
87
87
88
    //*********************************************************************
88
    //*********************************************************************
89
    // set its type and delegate validation to super-class
89
    // set its type and delegate validation to super-class
90
90
    @Override
91
    @Override
91
    public  ValidationMessage[] validate(
92
    public ValidationMessage[] validate(
92
	    String prefix, String uri, PageData page) {
93
            String prefix, String uri, PageData page) {
93
	return super.validate( TYPE_XML, prefix, uri, page );
94
        return super.validate(TYPE_XML, prefix, uri, page);
94
    }
95
    }
95
96
96
97
Lines 99-141 Link Here
99
100
100
    @Override
101
    @Override
101
    protected DefaultHandler getHandler() {
102
    protected DefaultHandler getHandler() {
102
	return new Handler();
103
        return new Handler();
103
    }
104
    }
104
105
105
106
106
    //*********************************************************************
107
    //*********************************************************************
107
    // SAX event handler
108
    // SAX event handler
108
109
109
    /** The handler that provides the base of our implementation. */
110
    /**
111
     * The handler that provides the base of our implementation.
112
     */
110
    private class Handler extends DefaultHandler {
113
    private class Handler extends DefaultHandler {
111
114
112
	// parser state
115
        // parser state
113
	private int depth = 0;
116
        private int depth = 0;
114
	private Stack chooseDepths = new Stack();
117
        private Stack chooseDepths = new Stack();
115
	private Stack chooseHasOtherwise = new Stack();
118
        private Stack chooseHasOtherwise = new Stack();
116
        private Stack chooseHasWhen = new Stack();
119
        private Stack chooseHasWhen = new Stack();
117
	private String lastElementName = null;
120
        private String lastElementName = null;
118
	private boolean bodyNecessary = false;
121
        private boolean bodyNecessary = false;
119
	private boolean bodyIllegal = false;
122
        private boolean bodyIllegal = false;
120
	private Stack transformWithSource = new Stack();
123
        private Stack transformWithSource = new Stack();
121
124
122
	// process under the existing context (state), then modify it
125
        // process under the existing context (state), then modify it
123
	@Override
124
    public void startElement(
125
	        String ns, String ln, String qn, Attributes a) {
126
126
127
        @Override
128
        public void startElement(
129
                String ns, String ln, String qn, Attributes a) {
130
127
            // substitute our own parsed 'ln' if it's not provided
131
            // substitute our own parsed 'ln' if it's not provided
128
            if (ln == null)
132
            if (ln == null) {
129
                ln = getLocalPart(qn);
133
                ln = getLocalPart(qn);
134
            }
130
135
131
	    // for simplicity, we can ignore <jsp:text> for our purposes
136
            // for simplicity, we can ignore <jsp:text> for our purposes
132
	    // (don't bother distinguishing between it and its characters)
137
            // (don't bother distinguishing between it and its characters)
133
	    if (qn.equals(JSP_TEXT))
138
            if (qn.equals(JSP_TEXT)) {
134
		return;
139
                return;
140
            }
135
141
136
	    // check body-related constraint
142
            // check body-related constraint
137
	    if (bodyIllegal)
143
            if (bodyIllegal) {
138
		fail(Resources.getMessage("TLV_ILLEGAL_BODY", lastElementName));
144
                fail(Resources.getMessage("TLV_ILLEGAL_BODY", lastElementName));
145
            }
139
146
140
            // validate expression syntax if we need to
147
            // validate expression syntax if we need to
141
            Set expAtts;
148
            Set expAtts;
Lines 145-310 Link Here
145
                    String attName = a.getLocalName(i);
152
                    String attName = a.getLocalName(i);
146
                    if (expAtts.contains(attName)) {
153
                    if (expAtts.contains(attName)) {
147
                        String vMsg =
154
                        String vMsg =
148
                            validateExpression(
155
                                validateExpression(
149
                                ln,
156
                                        ln,
150
                                attName,
157
                                        attName,
151
                                a.getValue(i));
158
                                        a.getValue(i));
152
                        if (vMsg != null)
159
                        if (vMsg != null) {
153
                            fail(vMsg);
160
                            fail(vMsg);
161
                        }
154
                    }
162
                    }
155
                }
163
                }
156
            }
164
            }
157
165
158
            // validate attributes
166
            // validate attributes
159
            if (qn.startsWith(prefix + ":") && !hasNoInvalidScope(a))
167
            if (qn.startsWith(prefix + ":") && !hasNoInvalidScope(a)) {
160
                fail(Resources.getMessage("TLV_INVALID_ATTRIBUTE",
168
                fail(Resources.getMessage("TLV_INVALID_ATTRIBUTE",
161
                    SCOPE, qn, a.getValue(SCOPE)));
169
                        SCOPE, qn, a.getValue(SCOPE)));
162
	    if (qn.startsWith(prefix + ":") && hasEmptyVar(a))
170
            }
163
		fail(Resources.getMessage("TLV_EMPTY_VAR", qn));
171
            if (qn.startsWith(prefix + ":") && hasEmptyVar(a)) {
164
            if (qn.startsWith(prefix + ":") && hasDanglingScope(a))
172
                fail(Resources.getMessage("TLV_EMPTY_VAR", qn));
173
            }
174
            if (qn.startsWith(prefix + ":") && hasDanglingScope(a)) {
165
                fail(Resources.getMessage("TLV_DANGLING_SCOPE", qn));
175
                fail(Resources.getMessage("TLV_DANGLING_SCOPE", qn));
176
            }
166
177
167
	    // check invariants for <choose>
178
            // check invariants for <choose>
168
	    if (chooseChild()) {
179
            if (chooseChild()) {
169
                // mark <choose> for the first the first <when>
180
                // mark <choose> for the first the first <when>
170
                if (isXmlTag(ns, ln, WHEN)) {
181
                if (isXmlTag(ns, ln, WHEN)) {
171
                    chooseHasWhen.pop();
182
                    chooseHasWhen.pop();
172
                    chooseHasWhen.push(Boolean.TRUE);
183
                    chooseHasWhen.push(Boolean.TRUE);
173
                }
184
                }
174
185
175
		// ensure <choose> has the right children
186
                // ensure <choose> has the right children
176
		if(!isXmlTag(ns, ln, WHEN) && !isXmlTag(ns, ln, OTHERWISE)) {
187
                if (!isXmlTag(ns, ln, WHEN) && !isXmlTag(ns, ln, OTHERWISE)) {
177
		    fail(Resources.getMessage("TLV_ILLEGAL_CHILD_TAG",
188
                    fail(Resources.getMessage("TLV_ILLEGAL_CHILD_TAG",
178
			prefix, CHOOSE, qn));
189
                            prefix, CHOOSE, qn));
179
		}
190
                }
180
191
181
		// make sure <otherwise> is the last tag
192
                // make sure <otherwise> is the last tag
182
		if (((Boolean) chooseHasOtherwise.peek()).booleanValue()) {
193
                if (((Boolean) chooseHasOtherwise.peek()).booleanValue()) {
183
		   fail(Resources.getMessage("TLV_ILLEGAL_ORDER",
194
                    fail(Resources.getMessage("TLV_ILLEGAL_ORDER",
184
			qn, prefix, OTHERWISE, CHOOSE));
195
                            qn, prefix, OTHERWISE, CHOOSE));
185
		}
196
                }
186
		if (isXmlTag(ns, ln, OTHERWISE)) {
197
                if (isXmlTag(ns, ln, OTHERWISE)) {
187
		    chooseHasOtherwise.pop();
198
                    chooseHasOtherwise.pop();
188
		    chooseHasOtherwise.push(Boolean.TRUE);
199
                    chooseHasOtherwise.push(Boolean.TRUE);
189
		}
200
                }
190
201
191
	    }
202
            }
192
203
193
	    // Specific check, directly inside <transform source="...">
204
            // Specific check, directly inside <transform source="...">
194
	    if (!transformWithSource.empty() &&
205
            if (!transformWithSource.empty() &&
195
		    topDepth(transformWithSource) == (depth - 1)) {
206
                    topDepth(transformWithSource) == (depth - 1)) {
196
		// only allow <param>
207
                // only allow <param>
197
		if (!isXmlTag(ns, ln, PARAM))
208
                if (!isXmlTag(ns, ln, PARAM)) {
198
		    fail(Resources.getMessage("TLV_ILLEGAL_BODY",
209
                    fail(Resources.getMessage("TLV_ILLEGAL_BODY",
199
			prefix + ":" + TRANSFORM));
210
                            prefix + ":" + TRANSFORM));
211
                }
200
212
201
		// thus, if we get the opportunity to hit depth++,
213
                // thus, if we get the opportunity to hit depth++,
202
		// we know we've got a <param> subtag
214
                // we know we've got a <param> subtag
203
	    }
215
            }
204
216
205
	    // now, modify state
217
            // now, modify state
206
218
207
	    // we're a choose, so record new choose-specific state
219
            // we're a choose, so record new choose-specific state
208
	    if (isXmlTag(ns, ln, CHOOSE)) {
220
            if (isXmlTag(ns, ln, CHOOSE)) {
209
		chooseDepths.push(new Integer(depth));
221
                chooseDepths.push(new Integer(depth));
210
                chooseHasWhen.push(Boolean.FALSE);
222
                chooseHasWhen.push(Boolean.FALSE);
211
		chooseHasOtherwise.push(Boolean.FALSE);
223
                chooseHasOtherwise.push(Boolean.FALSE);
212
	    }
224
            }
213
225
214
	    // set up a check against illegal attribute/body combinations
226
            // set up a check against illegal attribute/body combinations
215
	    bodyIllegal = false;
227
            bodyIllegal = false;
216
	    bodyNecessary = false;
228
            bodyNecessary = false;
217
	    if (isXmlTag(ns, ln, PARSE)) {
229
            if (isXmlTag(ns, ln, PARSE)) {
218
		if (hasAttribute(a, SOURCE))
230
                if (hasAttribute(a, SOURCE)) {
219
		    bodyIllegal = true;
231
                    bodyIllegal = true;
220
	    } else if (isXmlTag(ns, ln, PARAM)) {
232
                }
221
		if (hasAttribute(a, VALUE))
233
            } else if (isXmlTag(ns, ln, PARAM)) {
222
		    bodyIllegal = true;
234
                if (hasAttribute(a, VALUE)) {
223
		else
235
                    bodyIllegal = true;
224
		    bodyNecessary = true;
236
                } else {
225
	    } else if (isXmlTag(ns, ln, TRANSFORM)) {
237
                    bodyNecessary = true;
226
		if (hasAttribute(a, SOURCE))
238
                }
227
		    transformWithSource.push(new Integer(depth));
239
            } else if (isXmlTag(ns, ln, TRANSFORM)) {
228
	    }
240
                if (hasAttribute(a, SOURCE)) {
241
                    transformWithSource.push(new Integer(depth));
242
                }
243
            }
229
244
230
	    // record the most recent tag (for error reporting)
245
            // record the most recent tag (for error reporting)
231
	    lastElementName = qn;
246
            lastElementName = qn;
232
            lastElementId = a.getValue("http://java.sun.com/JSP/Page", "id");
247
            lastElementId = a.getValue("http://java.sun.com/JSP/Page", "id");
233
248
234
	    // we're a new element, so increase depth
249
            // we're a new element, so increase depth
235
	    depth++;
250
            depth++;
236
	}
251
        }
237
252
238
	@Override
253
        @Override
239
    public void characters(char[] ch, int start, int length) {
254
        public void characters(char[] ch, int start, int length) {
240
255
241
	    bodyNecessary = false;		// body is no longer necessary!
256
            bodyNecessary = false;        // body is no longer necessary!
242
257
243
	    // ignore strings that are just whitespace
258
            // ignore strings that are just whitespace
244
	    String s = new String(ch, start, length).trim();
259
            String s = new String(ch, start, length).trim();
245
	    if (s.equals(""))
260
            if (s.equals("")) {
246
		return;
261
                return;
262
            }
247
263
248
	    // check and update body-related constraints
264
            // check and update body-related constraints
249
	    if (bodyIllegal)
265
            if (bodyIllegal) {
250
		fail(Resources.getMessage("TLV_ILLEGAL_BODY", lastElementName));
266
                fail(Resources.getMessage("TLV_ILLEGAL_BODY", lastElementName));
267
            }
251
268
252
	    // make sure <choose> has no non-whitespace text
269
            // make sure <choose> has no non-whitespace text
253
	    if (chooseChild()) {
270
            if (chooseChild()) {
254
		String msg = 
271
                String msg =
255
		    Resources.getMessage("TLV_ILLEGAL_TEXT_BODY",
272
                        Resources.getMessage("TLV_ILLEGAL_TEXT_BODY",
256
			prefix, CHOOSE,
273
                                prefix, CHOOSE,
257
			(s.length() < 7 ? s : s.substring(0,7)));
274
                                (s.length() < 7 ? s : s.substring(0, 7)));
258
		fail(msg);
275
                fail(msg);
259
	    }
276
            }
260
277
261
            // Specific check, directly inside <transform source="...">
278
            // Specific check, directly inside <transform source="...">
262
            if (!transformWithSource.empty()
279
            if (!transformWithSource.empty()
263
		    && topDepth(transformWithSource) == (depth - 1)) {
280
                    && topDepth(transformWithSource) == (depth - 1)) {
264
                fail(Resources.getMessage("TLV_ILLEGAL_BODY",
281
                fail(Resources.getMessage("TLV_ILLEGAL_BODY",
265
                    prefix + ":" + TRANSFORM));
282
                        prefix + ":" + TRANSFORM));
266
            }
283
            }
267
	}
284
        }
268
285
269
	@Override
286
        @Override
270
    public void endElement(String ns, String ln, String qn) {
287
        public void endElement(String ns, String ln, String qn) {
271
288
272
	    // consistently, we ignore JSP_TEXT
289
            // consistently, we ignore JSP_TEXT
273
	    if (qn.equals(JSP_TEXT))
290
            if (qn.equals(JSP_TEXT)) {
274
		return;
291
                return;
292
            }
275
293
276
	    // handle body-related invariant
294
            // handle body-related invariant
277
	    if (bodyNecessary)
295
            if (bodyNecessary) {
278
		fail(Resources.getMessage("TLV_MISSING_BODY",
296
                fail(Resources.getMessage("TLV_MISSING_BODY",
279
		    lastElementName));
297
                        lastElementName));
280
	    bodyIllegal = false;	// reset: we've left the tag
298
            }
299
            bodyIllegal = false;    // reset: we've left the tag
281
300
282
	    // update <choose>-related state
301
            // update <choose>-related state
283
	    if (isXmlTag(ns, ln, CHOOSE)) {
302
            if (isXmlTag(ns, ln, CHOOSE)) {
284
                Boolean b = (Boolean) chooseHasWhen.pop();
303
                Boolean b = (Boolean) chooseHasWhen.pop();
285
                if (!b.booleanValue())
304
                if (!b.booleanValue()) {
286
                    fail(Resources.getMessage("TLV_PARENT_WITHOUT_SUBTAG",
305
                    fail(Resources.getMessage("TLV_PARENT_WITHOUT_SUBTAG",
287
                        CHOOSE, WHEN));
306
                            CHOOSE, WHEN));
288
		chooseDepths.pop();
307
                }
289
		chooseHasOtherwise.pop();
308
                chooseDepths.pop();
290
	    }
309
                chooseHasOtherwise.pop();
310
            }
291
311
292
	    // update <transform source="...">-related state
312
            // update <transform source="...">-related state
293
	    if (!transformWithSource.empty()
313
            if (!transformWithSource.empty()
294
		    && topDepth(transformWithSource) == (depth - 1))
314
                    && topDepth(transformWithSource) == (depth - 1)) {
295
		transformWithSource.pop();
315
                transformWithSource.pop();
316
            }
296
317
297
	    // update our depth
318
            // update our depth
298
	    depth--;
319
            depth--;
299
	}
320
        }
300
321
301
	// are we directly under a <choose>?
322
        // are we directly under a <choose>?
302
	private boolean chooseChild() {
303
	    return (!chooseDepths.empty()
304
		&& (depth - 1) == ((Integer) chooseDepths.peek()).intValue());
305
	}
306
323
324
        private boolean chooseChild() {
325
            return (!chooseDepths.empty()
326
                    && (depth - 1) == ((Integer) chooseDepths.peek()).intValue());
327
        }
328
307
        // returns the top int depth (peeked at) from a Stack of Integer
329
        // returns the top int depth (peeked at) from a Stack of Integer
330
308
        private int topDepth(Stack s) {
331
        private int topDepth(Stack s) {
309
            return ((Integer) s.peek()).intValue();
332
            return ((Integer) s.peek()).intValue();
310
        }
333
        }
(-)src/main/java/org/apache/taglibs/standard/tlv/JstlFmtTLV.java (-114 / +130 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tlv;
18
package org.apache.taglibs.standard.tlv;
19
19
Lines 30-42 Link Here
30
/**
30
/**
31
 * <p>A SAX-based TagLibraryValidator for the JSTL i18n-capable formatting
31
 * <p>A SAX-based TagLibraryValidator for the JSTL i18n-capable formatting
32
 * library. Currently implements the following checks:</p>
32
 * library. Currently implements the following checks:</p>
33
 * 
33
 * <p/>
34
 * <ul>
34
 * <ul>
35
 *   <li>Expression syntax validation.
35
 * <li>Expression syntax validation.
36
 *   <li>Tag bodies that must either be empty or non-empty given
36
 * <li>Tag bodies that must either be empty or non-empty given
37
 *      particular attributes.</li>
37
 * particular attributes.</li>
38
 * </ul>
38
 * </ul>
39
 * 
39
 *
40
 * @author Shawn Bayern
40
 * @author Shawn Bayern
41
 * @author Jan Luehe
41
 * @author Jan Luehe
42
 */
42
 */
Lines 92-101 Link Here
92
92
93
    //*********************************************************************
93
    //*********************************************************************
94
    // set its type and delegate validation to super-class
94
    // set its type and delegate validation to super-class
95
95
    @Override
96
    @Override
96
    public  ValidationMessage[] validate(
97
    public ValidationMessage[] validate(
97
	    String prefix, String uri, PageData page) {
98
            String prefix, String uri, PageData page) {
98
	return super.validate( TYPE_FMT, prefix, uri, page );
99
        return super.validate(TYPE_FMT, prefix, uri, page);
99
    }
100
    }
100
101
101
102
Lines 104-144 Link Here
104
105
105
    @Override
106
    @Override
106
    protected DefaultHandler getHandler() {
107
    protected DefaultHandler getHandler() {
107
	return new Handler();
108
        return new Handler();
108
    }
109
    }
109
110
110
111
111
    //*********************************************************************
112
    //*********************************************************************
112
    // SAX event handler
113
    // SAX event handler
113
114
114
    /** The handler that provides the base of our implementation. */
115
    /**
116
     * The handler that provides the base of our implementation.
117
     */
115
    private class Handler extends DefaultHandler {
118
    private class Handler extends DefaultHandler {
116
119
117
	// parser state
120
        // parser state
118
	private int depth = 0;
121
        private int depth = 0;
119
	private Stack messageDepths = new Stack();
122
        private Stack messageDepths = new Stack();
120
	private String lastElementName = null;
123
        private String lastElementName = null;
121
	private boolean bodyNecessary = false;
124
        private boolean bodyNecessary = false;
122
	private boolean bodyIllegal = false;
125
        private boolean bodyIllegal = false;
123
126
124
	// process under the existing context (state), then modify it
127
        // process under the existing context (state), then modify it
125
	@Override
126
    public void startElement(
127
	        String ns, String ln, String qn, Attributes a) {
128
128
129
        @Override
130
        public void startElement(
131
                String ns, String ln, String qn, Attributes a) {
132
129
            // substitute our own parsed 'ln' if it's not provided
133
            // substitute our own parsed 'ln' if it's not provided
130
            if (ln == null)
134
            if (ln == null) {
131
                ln = getLocalPart(qn);
135
                ln = getLocalPart(qn);
136
            }
132
137
133
	    // for simplicity, we can ignore <jsp:text> for our purposes
138
            // for simplicity, we can ignore <jsp:text> for our purposes
134
	    // (don't bother distinguishing between it and its characters)
139
            // (don't bother distinguishing between it and its characters)
135
	    if (qn.equals(JSP_TEXT))
140
            if (qn.equals(JSP_TEXT)) {
136
		return;
141
                return;
142
            }
137
143
138
	    // check body-related constraint
144
            // check body-related constraint
139
	    if (bodyIllegal)
145
            if (bodyIllegal) {
140
		fail(Resources.getMessage("TLV_ILLEGAL_BODY",
146
                fail(Resources.getMessage("TLV_ILLEGAL_BODY",
141
					  lastElementName));
147
                        lastElementName));
148
            }
142
149
143
            // validate expression syntax if we need to
150
            // validate expression syntax if we need to
144
            Set expAtts;
151
            Set expAtts;
Lines 148-261 Link Here
148
                    String attName = a.getLocalName(i);
155
                    String attName = a.getLocalName(i);
149
                    if (expAtts.contains(attName)) {
156
                    if (expAtts.contains(attName)) {
150
                        String vMsg =
157
                        String vMsg =
151
                            validateExpression(
158
                                validateExpression(
152
                                ln,
159
                                        ln,
153
                                attName,
160
                                        attName,
154
                                a.getValue(i));
161
                                        a.getValue(i));
155
                        if (vMsg != null)
162
                        if (vMsg != null) {
156
                            fail(vMsg);
163
                            fail(vMsg);
164
                        }
157
                    }
165
                    }
158
                }
166
                }
159
            }
167
            }
160
168
161
            // validate attributes
169
            // validate attributes
162
            if (qn.startsWith(prefix + ":") && !hasNoInvalidScope(a))
170
            if (qn.startsWith(prefix + ":") && !hasNoInvalidScope(a)) {
163
                fail(Resources.getMessage("TLV_INVALID_ATTRIBUTE",
171
                fail(Resources.getMessage("TLV_INVALID_ATTRIBUTE",
164
                    SCOPE, qn, a.getValue(SCOPE)));
172
                        SCOPE, qn, a.getValue(SCOPE)));
165
	    if (qn.startsWith(prefix + ":") && hasEmptyVar(a))
173
            }
166
		fail(Resources.getMessage("TLV_EMPTY_VAR", qn));
174
            if (qn.startsWith(prefix + ":") && hasEmptyVar(a)) {
175
                fail(Resources.getMessage("TLV_EMPTY_VAR", qn));
176
            }
167
            if (qn.startsWith(prefix + ":")
177
            if (qn.startsWith(prefix + ":")
168
                && !isFmtTag(ns, ln, SETLOCALE) 
178
                    && !isFmtTag(ns, ln, SETLOCALE)
169
		&& !isFmtTag(ns, ln, SETBUNDLE)
179
                    && !isFmtTag(ns, ln, SETBUNDLE)
170
		&& !isFmtTag(ns, ln, SETTIMEZONE)
180
                    && !isFmtTag(ns, ln, SETTIMEZONE)
171
                && hasDanglingScope(a))
181
                    && hasDanglingScope(a)) {
172
                fail(Resources.getMessage("TLV_DANGLING_SCOPE", qn));
182
                fail(Resources.getMessage("TLV_DANGLING_SCOPE", qn));
183
            }
173
184
174
	    /*
185
            /*
175
	     * Make sure <fmt:param> is nested inside <fmt:message>. Note that
186
            * Make sure <fmt:param> is nested inside <fmt:message>. Note that
176
	     * <fmt:param> does not need to be a direct child of <fmt:message>.
187
            * <fmt:param> does not need to be a direct child of <fmt:message>.
177
	     * Otherwise, the following would not work:
188
            * Otherwise, the following would not work:
178
	     *
189
            *
179
	     *  <fmt:message key="..." bundle="...">
190
            *  <fmt:message key="..." bundle="...">
180
	     *   <c:forEach var="arg" items="...">
191
            *   <c:forEach var="arg" items="...">
181
	     *    <fmt:param value="${arg}"/>
192
            *    <fmt:param value="${arg}"/>
182
	     *   </c:forEach>
193
            *   </c:forEach>
183
	     *  </fmt:message>
194
            *  </fmt:message>
184
	     */
195
            */
185
	    if (isFmtTag(ns, ln, MESSAGE_PARAM) && messageDepths.empty()) {
196
            if (isFmtTag(ns, ln, MESSAGE_PARAM) && messageDepths.empty()) {
186
		fail(Resources.getMessage("PARAM_OUTSIDE_MESSAGE"));
197
                fail(Resources.getMessage("PARAM_OUTSIDE_MESSAGE"));
187
	    }
198
            }
188
199
189
	    // now, modify state
200
            // now, modify state
190
201
191
	    // If we're in a <message>, record relevant state
202
            // If we're in a <message>, record relevant state
192
	    if (isFmtTag(ns, ln, MESSAGE)) {
203
            if (isFmtTag(ns, ln, MESSAGE)) {
193
		messageDepths.push(new Integer(depth));
204
                messageDepths.push(new Integer(depth));
194
	    }
205
            }
195
206
196
	    // set up a check against illegal attribute/body combinations
207
            // set up a check against illegal attribute/body combinations
197
	    bodyIllegal = false;
208
            bodyIllegal = false;
198
	    bodyNecessary = false;
209
            bodyNecessary = false;
199
	    if (isFmtTag(ns, ln, MESSAGE_PARAM)
210
            if (isFmtTag(ns, ln, MESSAGE_PARAM)
200
		    || isFmtTag(ns, ln, FORMAT_NUMBER)
211
                    || isFmtTag(ns, ln, FORMAT_NUMBER)
201
		    || isFmtTag(ns, ln, PARSE_NUMBER)
212
                    || isFmtTag(ns, ln, PARSE_NUMBER)
202
		    || isFmtTag(ns, ln,  PARSE_DATE)) {
213
                    || isFmtTag(ns, ln, PARSE_DATE)) {
203
		if (hasAttribute(a, VALUE))
214
                if (hasAttribute(a, VALUE)) {
204
		    bodyIllegal = true;
215
                    bodyIllegal = true;
205
		else
216
                } else {
206
		    bodyNecessary = true;
217
                    bodyNecessary = true;
207
	    } else if (isFmtTag(ns, ln, MESSAGE)
218
                }
208
		    && !hasAttribute(a, MESSAGE_KEY)) {
219
            } else if (isFmtTag(ns, ln, MESSAGE)
209
		bodyNecessary = true;
220
                    && !hasAttribute(a, MESSAGE_KEY)) {
210
	    } else if (isFmtTag(ns, ln, BUNDLE)
221
                bodyNecessary = true;
211
		    && hasAttribute(a, BUNDLE_PREFIX)) {
222
            } else if (isFmtTag(ns, ln, BUNDLE)
212
		bodyNecessary = true;
223
                    && hasAttribute(a, BUNDLE_PREFIX)) {
213
	    }
224
                bodyNecessary = true;
225
            }
214
226
215
	    // record the most recent tag (for error reporting)
227
            // record the most recent tag (for error reporting)
216
	    lastElementName = qn;
228
            lastElementName = qn;
217
            lastElementId = a.getValue(JSP, "id");
229
            lastElementId = a.getValue(JSP, "id");
218
230
219
	    // we're a new element, so increase depth
231
            // we're a new element, so increase depth
220
	    depth++;
232
            depth++;
221
	}
233
        }
222
234
223
	@Override
235
        @Override
224
    public void characters(char[] ch, int start, int length) {
236
        public void characters(char[] ch, int start, int length) {
225
237
226
	    bodyNecessary = false;		// body is no longer necessary!
238
            bodyNecessary = false;        // body is no longer necessary!
227
239
228
	    // ignore strings that are just whitespace
240
            // ignore strings that are just whitespace
229
	    String s = new String(ch, start, length).trim();
241
            String s = new String(ch, start, length).trim();
230
	    if (s.equals(""))
242
            if (s.equals("")) {
231
		return;
243
                return;
244
            }
232
245
233
	    // check and update body-related constraints
246
            // check and update body-related constraints
234
	    if (bodyIllegal)
247
            if (bodyIllegal) {
235
		fail(Resources.getMessage("TLV_ILLEGAL_BODY",
248
                fail(Resources.getMessage("TLV_ILLEGAL_BODY",
236
					  lastElementName));
249
                        lastElementName));
237
	}
250
            }
251
        }
238
252
239
	@Override
253
        @Override
240
    public void endElement(String ns, String ln, String qn) {
254
        public void endElement(String ns, String ln, String qn) {
241
255
242
	    // consistently, we ignore JSP_TEXT
256
            // consistently, we ignore JSP_TEXT
243
	    if (qn.equals(JSP_TEXT))
257
            if (qn.equals(JSP_TEXT)) {
244
		return;
258
                return;
259
            }
245
260
246
	    // handle body-related invariant
261
            // handle body-related invariant
247
	    if (bodyNecessary)
262
            if (bodyNecessary) {
248
		fail(Resources.getMessage("TLV_MISSING_BODY",
263
                fail(Resources.getMessage("TLV_MISSING_BODY",
249
		    lastElementName));
264
                        lastElementName));
250
	    bodyIllegal = false;	// reset: we've left the tag
265
            }
266
            bodyIllegal = false;    // reset: we've left the tag
251
267
252
	    // update <message>-related state
268
            // update <message>-related state
253
	    if (isFmtTag(ns, ln, MESSAGE)) {
269
            if (isFmtTag(ns, ln, MESSAGE)) {
254
		messageDepths.pop();
270
                messageDepths.pop();
255
	    }
271
            }
256
272
257
	    // update our depth
273
            // update our depth
258
	    depth--;
274
            depth--;
259
	}
275
        }
260
    }
276
    }
261
}
277
}
(-)src/main/java/org/apache/taglibs/standard/tlv/JstlCoreTLV.java (-195 / +220 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tlv;
18
package org.apache.taglibs.standard.tlv;
19
19
Lines 30-47 Link Here
30
/**
30
/**
31
 * <p>A SAX-based TagLibraryValidator for the core JSTL tag library.
31
 * <p>A SAX-based TagLibraryValidator for the core JSTL tag library.
32
 * Currently implements the following checks:</p>
32
 * Currently implements the following checks:</p>
33
 * 
33
 * <p/>
34
 * <ul>
34
 * <ul>
35
 *   <li>Expression syntax validation.
35
 * <li>Expression syntax validation.
36
 *   <li>Choose / when / otherwise constraints</li>
36
 * <li>Choose / when / otherwise constraints</li>
37
 *   <li>Tag bodies that must either be empty or non-empty given
37
 * <li>Tag bodies that must either be empty or non-empty given
38
 *      particular attributes.  (E.g., <set> cannot have a body when
38
 * particular attributes.  (E.g., <set> cannot have a body when
39
 *      'value' is specified; it *must* have a body otherwise.)  For
39
 * 'value' is specified; it *must* have a body otherwise.)  For
40
 *      these purposes, "having a body" refers to non-whitespace
40
 * these purposes, "having a body" refers to non-whitespace
41
 *      content inside the tag.</li>
41
 * content inside the tag.</li>
42
 *   <li>Other minor constraints.</li>
42
 * <li>Other minor constraints.</li>
43
 * </ul>
43
 * </ul>
44
 * 
44
 *
45
 * @author Shawn Bayern
45
 * @author Shawn Bayern
46
 */
46
 */
47
public class JstlCoreTLV extends JstlBaseTLV {
47
public class JstlCoreTLV extends JstlBaseTLV {
Lines 92-101 Link Here
92
92
93
    //*********************************************************************
93
    //*********************************************************************
94
    // set its type and delegate validation to super-class
94
    // set its type and delegate validation to super-class
95
95
    @Override
96
    @Override
96
    public  ValidationMessage[] validate(
97
    public ValidationMessage[] validate(
97
	    String prefix, String uri, PageData page) {
98
            String prefix, String uri, PageData page) {
98
	return super.validate( TYPE_CORE, prefix, uri, page );
99
        return super.validate(TYPE_CORE, prefix, uri, page);
99
    }
100
    }
100
101
101
102
Lines 104-332 Link Here
104
105
105
    @Override
106
    @Override
106
    protected DefaultHandler getHandler() {
107
    protected DefaultHandler getHandler() {
107
	return new Handler();
108
        return new Handler();
108
    }
109
    }
109
110
110
111
111
    //*********************************************************************
112
    //*********************************************************************
112
    // SAX event handler
113
    // SAX event handler
113
114
114
    /** The handler that provides the base of our implementation. */
115
    /**
116
     * The handler that provides the base of our implementation.
117
     */
115
    private class Handler extends DefaultHandler {
118
    private class Handler extends DefaultHandler {
116
119
117
	// parser state
120
        // parser state
118
	private int depth = 0;
121
        private int depth = 0;
119
	private Stack chooseDepths = new Stack();
122
        private Stack chooseDepths = new Stack();
120
	private Stack chooseHasOtherwise = new Stack();
123
        private Stack chooseHasOtherwise = new Stack();
121
	private Stack chooseHasWhen = new Stack();
124
        private Stack chooseHasWhen = new Stack();
122
        private Stack urlTags = new Stack();
125
        private Stack urlTags = new Stack();
123
	private String lastElementName = null;
126
        private String lastElementName = null;
124
	private boolean bodyNecessary = false;
127
        private boolean bodyNecessary = false;
125
	private boolean bodyIllegal = false;
128
        private boolean bodyIllegal = false;
126
129
127
	// process under the existing context (state), then modify it
130
        // process under the existing context (state), then modify it
128
	@Override
129
    public void startElement(
130
	        String ns, String ln, String qn, Attributes a) {
131
131
132
	    // substitute our own parsed 'ln' if it's not provided
132
        @Override
133
	    if (ln == null)
133
        public void startElement(
134
		ln = getLocalPart(qn);
134
                String ns, String ln, String qn, Attributes a) {
135
135
136
	    // for simplicity, we can ignore <jsp:text> for our purposes
136
            // substitute our own parsed 'ln' if it's not provided
137
	    // (don't bother distinguishing between it and its characters)
137
            if (ln == null) {
138
	    if (isJspTag(ns, ln, TEXT))
138
                ln = getLocalPart(qn);
139
		return;
139
            }
140
140
141
	    // check body-related constraint
141
            // for simplicity, we can ignore <jsp:text> for our purposes
142
	    if (bodyIllegal)
142
            // (don't bother distinguishing between it and its characters)
143
		fail(Resources.getMessage("TLV_ILLEGAL_BODY", lastElementName));
143
            if (isJspTag(ns, ln, TEXT)) {
144
                return;
145
            }
144
146
145
	    // validate expression syntax if we need to
147
            // check body-related constraint
146
	    Set expAtts;
148
            if (bodyIllegal) {
147
	    if (qn.startsWith(prefix + ":")
149
                fail(Resources.getMessage("TLV_ILLEGAL_BODY", lastElementName));
148
		    && (expAtts = (Set) config.get(ln)) != null) {
150
            }
149
		for (int i = 0; i < a.getLength(); i++) {
150
		    String attName = a.getLocalName(i);
151
		    if (expAtts.contains(attName)) {
152
			String vMsg =
153
			    validateExpression(
154
				ln,
155
				attName,
156
				a.getValue(i));
157
			if (vMsg != null)
158
			    fail(vMsg);
159
		    }
160
		}
161
	    }
162
151
152
            // validate expression syntax if we need to
153
            Set expAtts;
154
            if (qn.startsWith(prefix + ":")
155
                    && (expAtts = (Set) config.get(ln)) != null) {
156
                for (int i = 0; i < a.getLength(); i++) {
157
                    String attName = a.getLocalName(i);
158
                    if (expAtts.contains(attName)) {
159
                        String vMsg =
160
                                validateExpression(
161
                                        ln,
162
                                        attName,
163
                                        a.getValue(i));
164
                        if (vMsg != null) {
165
                            fail(vMsg);
166
                        }
167
                    }
168
                }
169
            }
170
163
            // validate attributes
171
            // validate attributes
164
            if (qn.startsWith(prefix + ":") && !hasNoInvalidScope(a))
172
            if (qn.startsWith(prefix + ":") && !hasNoInvalidScope(a)) {
165
                fail(Resources.getMessage("TLV_INVALID_ATTRIBUTE",
173
                fail(Resources.getMessage("TLV_INVALID_ATTRIBUTE",
166
                    SCOPE, qn, a.getValue(SCOPE))); 
174
                        SCOPE, qn, a.getValue(SCOPE)));
167
	    if (qn.startsWith(prefix + ":") && hasEmptyVar(a))
175
            }
168
		fail(Resources.getMessage("TLV_EMPTY_VAR", qn));
176
            if (qn.startsWith(prefix + ":") && hasEmptyVar(a)) {
169
	    if (qn.startsWith(prefix + ":") && hasDanglingScope(a))
177
                fail(Resources.getMessage("TLV_EMPTY_VAR", qn));
170
		fail(Resources.getMessage("TLV_DANGLING_SCOPE", qn));
178
            }
179
            if (qn.startsWith(prefix + ":") && hasDanglingScope(a)) {
180
                fail(Resources.getMessage("TLV_DANGLING_SCOPE", qn));
181
            }
171
182
172
	    // check invariants for <choose>
183
            // check invariants for <choose>
173
	    if (chooseChild()) {
184
            if (chooseChild()) {
174
		// mark <choose> for the first the first <when>
185
                // mark <choose> for the first the first <when>
175
		if (isCoreTag(ns, ln, WHEN)) {
186
                if (isCoreTag(ns, ln, WHEN)) {
176
		    chooseHasWhen.pop();
187
                    chooseHasWhen.pop();
177
		    chooseHasWhen.push(Boolean.TRUE);
188
                    chooseHasWhen.push(Boolean.TRUE);
178
		}
189
                }
179
190
180
		// ensure <choose> has the right children
191
                // ensure <choose> has the right children
181
		if(!isCoreTag(ns, ln, WHEN) && !isCoreTag(ns, ln, OTHERWISE)) {
192
                if (!isCoreTag(ns, ln, WHEN) && !isCoreTag(ns, ln, OTHERWISE)) {
182
		    fail(Resources.getMessage("TLV_ILLEGAL_CHILD_TAG",
193
                    fail(Resources.getMessage("TLV_ILLEGAL_CHILD_TAG",
183
			prefix, CHOOSE, qn));
194
                            prefix, CHOOSE, qn));
184
		}
195
                }
185
196
186
		// make sure <otherwise> is the last tag
197
                // make sure <otherwise> is the last tag
187
		if (((Boolean) chooseHasOtherwise.peek()).booleanValue()) {
198
                if (((Boolean) chooseHasOtherwise.peek()).booleanValue()) {
188
		   fail(Resources.getMessage("TLV_ILLEGAL_ORDER",
199
                    fail(Resources.getMessage("TLV_ILLEGAL_ORDER",
189
			qn, prefix, OTHERWISE, CHOOSE));
200
                            qn, prefix, OTHERWISE, CHOOSE));
190
		}
201
                }
191
		if (isCoreTag(ns, ln, OTHERWISE)) {
202
                if (isCoreTag(ns, ln, OTHERWISE)) {
192
		    chooseHasOtherwise.pop();
203
                    chooseHasOtherwise.pop();
193
		    chooseHasOtherwise.push(Boolean.TRUE);
204
                    chooseHasOtherwise.push(Boolean.TRUE);
194
		}
205
                }
195
206
196
	    }
207
            }
197
208
198
	    // check constraints for <param> vis-a-vis URL-related tags
209
            // check constraints for <param> vis-a-vis URL-related tags
199
	    if (isCoreTag(ns, ln, PARAM)) {
210
            if (isCoreTag(ns, ln, PARAM)) {
200
		// no <param> outside URL tags.
211
                // no <param> outside URL tags.
201
		if (urlTags.empty() || urlTags.peek().equals(PARAM))
212
                if (urlTags.empty() || urlTags.peek().equals(PARAM)) {
202
		    fail(Resources.getMessage("TLV_ILLEGAL_ORPHAN", PARAM));
213
                    fail(Resources.getMessage("TLV_ILLEGAL_ORPHAN", PARAM));
214
                }
203
215
204
		// no <param> where the most recent <import> has a reader
216
                // no <param> where the most recent <import> has a reader
205
		if (!urlTags.empty() &&
217
                if (!urlTags.empty() &&
206
			urlTags.peek().equals(IMPORT_WITH_READER))
218
                        urlTags.peek().equals(IMPORT_WITH_READER)) {
207
		    fail(Resources.getMessage("TLV_ILLEGAL_PARAM",
219
                    fail(Resources.getMessage("TLV_ILLEGAL_PARAM",
208
			prefix, PARAM, IMPORT, VAR_READER));
220
                            prefix, PARAM, IMPORT, VAR_READER));
209
	    } else {
221
                }
210
		// tag ISN'T <param>, so it's illegal under non-reader <import>
222
            } else {
211
		if (!urlTags.empty()
223
                // tag ISN'T <param>, so it's illegal under non-reader <import>
212
			&& urlTags.peek().equals(IMPORT_WITHOUT_READER))
224
                if (!urlTags.empty()
213
		    fail(Resources.getMessage("TLV_ILLEGAL_CHILD_TAG",
225
                        && urlTags.peek().equals(IMPORT_WITHOUT_READER)) {
214
			prefix, IMPORT, qn));
226
                    fail(Resources.getMessage("TLV_ILLEGAL_CHILD_TAG",
215
	    }
227
                            prefix, IMPORT, qn));
228
                }
229
            }
216
230
217
	    // now, modify state
231
            // now, modify state
218
232
219
	    // we're a choose, so record new choose-specific state
233
            // we're a choose, so record new choose-specific state
220
	    if (isCoreTag(ns, ln, CHOOSE)) {
234
            if (isCoreTag(ns, ln, CHOOSE)) {
221
		chooseDepths.push(new Integer(depth));
235
                chooseDepths.push(new Integer(depth));
222
		chooseHasWhen.push(Boolean.FALSE);
236
                chooseHasWhen.push(Boolean.FALSE);
223
		chooseHasOtherwise.push(Boolean.FALSE);
237
                chooseHasOtherwise.push(Boolean.FALSE);
224
	    }
238
            }
225
239
226
	    // if we're introducing a URL-related tag, record it
240
            // if we're introducing a URL-related tag, record it
227
	    if (isCoreTag(ns, ln, IMPORT)) {
241
            if (isCoreTag(ns, ln, IMPORT)) {
228
		if (hasAttribute(a, VAR_READER))
242
                if (hasAttribute(a, VAR_READER)) {
229
		    urlTags.push(IMPORT_WITH_READER);
243
                    urlTags.push(IMPORT_WITH_READER);
230
		else
244
                } else {
231
		    urlTags.push(IMPORT_WITHOUT_READER);
245
                    urlTags.push(IMPORT_WITHOUT_READER);
232
	    } else if (isCoreTag(ns, ln, PARAM))
246
                }
233
		urlTags.push(PARAM);
247
            } else if (isCoreTag(ns, ln, PARAM)) {
234
	    else if (isCoreTag(ns, ln, REDIRECT))
248
                urlTags.push(PARAM);
235
		urlTags.push(REDIRECT);
249
            } else if (isCoreTag(ns, ln, REDIRECT)) {
236
	    else if (isCoreTag(ns, ln, URL))
250
                urlTags.push(REDIRECT);
237
		urlTags.push(URL);
251
            } else if (isCoreTag(ns, ln, URL)) {
252
                urlTags.push(URL);
253
            }
238
254
239
	    // set up a check against illegal attribute/body combinations
255
            // set up a check against illegal attribute/body combinations
240
	    bodyIllegal = false;
256
            bodyIllegal = false;
241
	    bodyNecessary = false;
257
            bodyNecessary = false;
242
	    if (isCoreTag(ns, ln, EXPR)) {
258
            if (isCoreTag(ns, ln, EXPR)) {
243
		if (hasAttribute(a, DEFAULT))
259
                if (hasAttribute(a, DEFAULT)) {
244
		    bodyIllegal = true;
260
                    bodyIllegal = true;
245
	    } else if (isCoreTag(ns, ln, SET)) {
261
                }
246
		if (hasAttribute(a, VALUE))
262
            } else if (isCoreTag(ns, ln, SET)) {
247
		    bodyIllegal = true;
263
                if (hasAttribute(a, VALUE)) {
248
		// else
264
                    bodyIllegal = true;
249
		//    bodyNecessary = true;
265
                }
250
	    }
266
                // else
267
                //    bodyNecessary = true;
268
            }
251
269
252
	    // record the most recent tag (for error reporting)
270
            // record the most recent tag (for error reporting)
253
	    lastElementName = qn;
271
            lastElementName = qn;
254
	    lastElementId = a.getValue(JSP, "id");
272
            lastElementId = a.getValue(JSP, "id");
255
273
256
	    // we're a new element, so increase depth
274
            // we're a new element, so increase depth
257
	    depth++;
275
            depth++;
258
	}
276
        }
259
277
260
	@Override
278
        @Override
261
    public void characters(char[] ch, int start, int length) {
279
        public void characters(char[] ch, int start, int length) {
262
280
263
	    bodyNecessary = false;		// body is no longer necessary!
281
            bodyNecessary = false;        // body is no longer necessary!
264
282
265
	    // ignore strings that are just whitespace
283
            // ignore strings that are just whitespace
266
	    String s = new String(ch, start, length).trim();
284
            String s = new String(ch, start, length).trim();
267
	    if (s.equals(""))
285
            if (s.equals("")) {
268
		return;
286
                return;
287
            }
269
288
270
	    // check and update body-related constraints
289
            // check and update body-related constraints
271
	    if (bodyIllegal)
290
            if (bodyIllegal) {
272
		fail(Resources.getMessage("TLV_ILLEGAL_BODY", lastElementName));
291
                fail(Resources.getMessage("TLV_ILLEGAL_BODY", lastElementName));
273
	    if (!urlTags.empty()
292
            }
274
		    && urlTags.peek().equals(IMPORT_WITHOUT_READER)) {
293
            if (!urlTags.empty()
275
		// we're in an <import> without a Reader; nothing but
294
                    && urlTags.peek().equals(IMPORT_WITHOUT_READER)) {
276
		// <param> is allowed
295
                // we're in an <import> without a Reader; nothing but
277
		fail(Resources.getMessage("TLV_ILLEGAL_BODY",
296
                // <param> is allowed
278
		    prefix + ":" + IMPORT));
297
                fail(Resources.getMessage("TLV_ILLEGAL_BODY",
279
	    }
298
                        prefix + ":" + IMPORT));
299
            }
280
300
281
	    // make sure <choose> has no non-whitespace text
301
            // make sure <choose> has no non-whitespace text
282
	    if (chooseChild()) {
302
            if (chooseChild()) {
283
		String msg = 
303
                String msg =
284
		    Resources.getMessage("TLV_ILLEGAL_TEXT_BODY",
304
                        Resources.getMessage("TLV_ILLEGAL_TEXT_BODY",
285
			prefix, CHOOSE,
305
                                prefix, CHOOSE,
286
			(s.length() < 7 ? s : s.substring(0,7)));
306
                                (s.length() < 7 ? s : s.substring(0, 7)));
287
		fail(msg);
307
                fail(msg);
288
	    }
308
            }
289
	}
309
        }
290
310
291
	@Override
311
        @Override
292
    public void endElement(String ns, String ln, String qn) {
312
        public void endElement(String ns, String ln, String qn) {
293
313
294
	    // consistently, we ignore JSP_TEXT
314
            // consistently, we ignore JSP_TEXT
295
	    if (isJspTag(ns, ln, TEXT))
315
            if (isJspTag(ns, ln, TEXT)) {
296
		return;
316
                return;
317
            }
297
318
298
	    // handle body-related invariant
319
            // handle body-related invariant
299
	    if (bodyNecessary)
320
            if (bodyNecessary) {
300
		fail(Resources.getMessage("TLV_MISSING_BODY",
321
                fail(Resources.getMessage("TLV_MISSING_BODY",
301
		    lastElementName));
322
                        lastElementName));
302
	    bodyIllegal = false;	// reset: we've left the tag
323
            }
324
            bodyIllegal = false;    // reset: we've left the tag
303
325
304
	    // update <choose>-related state
326
            // update <choose>-related state
305
	    if (isCoreTag(ns, ln, CHOOSE)) {
327
            if (isCoreTag(ns, ln, CHOOSE)) {
306
		Boolean b = (Boolean) chooseHasWhen.pop();
328
                Boolean b = (Boolean) chooseHasWhen.pop();
307
		if (!b.booleanValue())
329
                if (!b.booleanValue()) {
308
		    fail(Resources.getMessage("TLV_PARENT_WITHOUT_SUBTAG",
330
                    fail(Resources.getMessage("TLV_PARENT_WITHOUT_SUBTAG",
309
			CHOOSE, WHEN));
331
                            CHOOSE, WHEN));
310
		chooseDepths.pop();
332
                }
311
		chooseHasOtherwise.pop();
333
                chooseDepths.pop();
312
	    }
334
                chooseHasOtherwise.pop();
335
            }
313
336
314
	    // update state related to URL tags
337
            // update state related to URL tags
315
	    if (isCoreTag(ns, ln, IMPORT)
338
            if (isCoreTag(ns, ln, IMPORT)
316
                    || isCoreTag(ns, ln, PARAM)
339
                    || isCoreTag(ns, ln, PARAM)
317
		    || isCoreTag(ns, ln, REDIRECT)
340
                    || isCoreTag(ns, ln, REDIRECT)
318
		    || isCoreTag(ns, ln, URL))
341
                    || isCoreTag(ns, ln, URL)) {
319
		urlTags.pop();
342
                urlTags.pop();
343
            }
320
344
321
	    // update our depth
345
            // update our depth
322
	    depth--;
346
            depth--;
323
	}
347
        }
324
348
325
	// are we directly under a <choose>?
349
        // are we directly under a <choose>?
326
	private boolean chooseChild() {
327
	    return (!chooseDepths.empty()
328
		&& (depth - 1) == ((Integer) chooseDepths.peek()).intValue());
329
	}
330
350
351
        private boolean chooseChild() {
352
            return (!chooseDepths.empty()
353
                    && (depth - 1) == ((Integer) chooseDepths.peek()).intValue());
354
        }
355
331
    }
356
    }
332
}
357
}
(-)src/main/java/org/apache/taglibs/standard/tlv/JstlBaseTLV.java (-115 / +135 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tlv;
18
package org.apache.taglibs.standard.tlv;
19
19
Lines 41-47 Link Here
41
41
42
/**
42
/**
43
 * <p>A base class to support SAX-based validation in JSTL.</p>
43
 * <p>A base class to support SAX-based validation in JSTL.</p>
44
 * 
44
 *
45
 * @author Shawn Bayern
45
 * @author Shawn Bayern
46
 */
46
 */
47
public abstract class JstlBaseTLV extends TagLibraryValidator {
47
public abstract class JstlBaseTLV extends TagLibraryValidator {
Lines 66-84 Link Here
66
66
67
    // attributes
67
    // attributes
68
    protected static final String VAR = "var";
68
    protected static final String VAR = "var";
69
    protected static final String SCOPE = "scope";  
69
    protected static final String SCOPE = "scope";
70
70
71
    //scopes
71
    //scopes
72
    protected static final String PAGE_SCOPE = "page";        
72
    protected static final String PAGE_SCOPE = "page";
73
    protected static final String REQUEST_SCOPE = "request";  
73
    protected static final String REQUEST_SCOPE = "request";
74
    protected static final String SESSION_SCOPE = "session";  
74
    protected static final String SESSION_SCOPE = "session";
75
    protected static final String APPLICATION_SCOPE = "application";
75
    protected static final String APPLICATION_SCOPE = "application";
76
76
77
    // Relevant URIs
77
    // Relevant URIs
78
    protected final String JSP = "http://java.sun.com/JSP/Page"; 
78
    protected final String JSP = "http://java.sun.com/JSP/Page";
79
    
79
80
    // types of sub-classes - used on method validate()
80
    // types of sub-classes - used on method validate()
81
    private   static final int TYPE_UNDEFINED = 0;
81
    private static final int TYPE_UNDEFINED = 0;
82
    protected static final int TYPE_CORE = 1;
82
    protected static final int TYPE_CORE = 1;
83
    protected static final int TYPE_FMT = 2;
83
    protected static final int TYPE_FMT = 2;
84
    protected static final int TYPE_SQL = 3;
84
    protected static final int TYPE_SQL = 3;
Lines 90-171 Link Here
90
    //*********************************************************************
90
    //*********************************************************************
91
    // Validation and configuration state (protected)
91
    // Validation and configuration state (protected)
92
92
93
    protected String uri;			// our taglib's uri (as passed by JSP container on XML View)
93
    protected String uri;            // our taglib's uri (as passed by JSP container on XML View)
94
    protected String prefix;			// our taglib's prefix
94
    protected String prefix;            // our taglib's prefix
95
    protected Vector messageVector;		// temporary error messages
95
    protected Vector messageVector;        // temporary error messages
96
    protected Map config;			// configuration (Map of Sets)
96
    protected Map config;            // configuration (Map of Sets)
97
    protected boolean failed;			// have we failed >0 times?
97
    protected boolean failed;            // have we failed >0 times?
98
    protected String lastElementId;		// the last element we've seen
98
    protected String lastElementId;        // the last element we've seen
99
99
100
    //*********************************************************************
100
    //*********************************************************************
101
    // Constructor and lifecycle management
101
    // Constructor and lifecycle management
102
102
103
    public JstlBaseTLV() {
103
    public JstlBaseTLV() {
104
	super();
104
        super();
105
	init();
105
        init();
106
    }
106
    }
107
107
108
    private void init() {
108
    private void init() {
109
	messageVector = null;
109
        messageVector = null;
110
	prefix = null;
110
        prefix = null;
111
	config = null;
111
        config = null;
112
    }
112
    }
113
113
114
    @Override
114
    @Override
115
    public void release() {
115
    public void release() {
116
	super.release();
116
        super.release();
117
	init();
117
        init();
118
    }
118
    }
119
    
120
119
120
121
    //*********************************************************************
121
    //*********************************************************************
122
    // Validation entry point - this method is called by the sub-classes to 
122
    // Validation entry point - this method is called by the sub-classes to 
123
    // do the validation.
123
    // do the validation.
124
124
125
    public synchronized ValidationMessage[] validate(
125
    public synchronized ValidationMessage[] validate(
126
	    int type, String prefix, String uri, PageData page) {
126
            int type, String prefix, String uri, PageData page) {
127
	try {
127
        try {
128
	    this.tlvType = type;
128
            this.tlvType = type;
129
	    this.uri = uri;
129
            this.uri = uri;
130
	    // initialize
130
            // initialize
131
	    messageVector = new Vector();
131
            messageVector = new Vector();
132
132
133
	    // save the prefix
133
            // save the prefix
134
	    this.prefix = prefix;
134
            this.prefix = prefix;
135
135
136
	    // parse parameters if necessary
136
            // parse parameters if necessary
137
	    try {
137
            try {
138
		if (config == null)
138
                if (config == null) {
139
		    configure((String) getInitParameters().get(EXP_ATT_PARAM));
139
                    configure((String) getInitParameters().get(EXP_ATT_PARAM));
140
	    } catch (NoSuchElementException ex) {
140
                }
141
		// parsing error
141
            } catch (NoSuchElementException ex) {
142
	        return vmFromString(
142
                // parsing error
143
		    Resources.getMessage("TLV_PARAMETER_ERROR",
143
                return vmFromString(
144
			EXP_ATT_PARAM));
144
                        Resources.getMessage("TLV_PARAMETER_ERROR",
145
	    }
145
                                EXP_ATT_PARAM));
146
            }
146
147
147
	    // get a handler
148
            // get a handler
148
	    DefaultHandler h = getHandler();
149
            DefaultHandler h = getHandler();
149
150
150
	    // parse the page
151
            // parse the page
151
	    SAXParserFactory f = SAXParserFactory.newInstance();
152
            SAXParserFactory f = SAXParserFactory.newInstance();
152
	    f.setValidating(false);
153
            f.setValidating(false);
153
	    f.setNamespaceAware(true);
154
            f.setNamespaceAware(true);
154
	    SAXParser p = f.newSAXParser();
155
            SAXParser p = f.newSAXParser();
155
	    p.parse(page.getInputStream(), h);
156
            p.parse(page.getInputStream(), h);
156
157
157
	    if (messageVector.size() == 0)
158
            if (messageVector.size() == 0) {
158
		return null;
159
                return null;
159
	    else
160
            } else {
160
		return vmFromVector(messageVector);
161
                return vmFromVector(messageVector);
162
            }
161
163
162
	} catch (SAXException ex) {
164
        } catch (SAXException ex) {
163
	    return vmFromString(ex.toString());
165
            return vmFromString(ex.toString());
164
	} catch (ParserConfigurationException ex) {
166
        } catch (ParserConfigurationException ex) {
165
	    return vmFromString(ex.toString());
167
            return vmFromString(ex.toString());
166
	} catch (IOException ex) {
168
        } catch (IOException ex) {
167
	    return vmFromString(ex.toString());
169
            return vmFromString(ex.toString());
168
	}
170
        }
169
    }
171
    }
170
172
171
    //*********************************************************************
173
    //*********************************************************************
Lines 173-196 Link Here
173
175
174
    // delegate validation to the appropriate expression language
176
    // delegate validation to the appropriate expression language
175
    // TODO refactor this into EL tag specific functionality
177
    // TODO refactor this into EL tag specific functionality
178
176
    @Deprecated
179
    @Deprecated
177
    protected String validateExpression(
180
    protected String validateExpression(
178
	    String elem, String att, String expr) {
181
            String elem, String att, String expr) {
179
182
180
        return null;
183
        return null;
181
    }
184
    }
182
185
183
    // utility methods to help us match elements in our tagset
186
    // utility methods to help us match elements in our tagset
187
184
    protected boolean isTag(String tagUri,
188
    protected boolean isTag(String tagUri,
185
			    String tagLn,
189
                            String tagLn,
186
			    String matchUri,
190
                            String matchUri,
187
			    String matchLn) {
191
                            String matchLn) {
188
	if (tagUri == null
192
        if (tagUri == null
189
                || tagUri.length() == 0
193
                || tagUri.length() == 0
190
	        || tagLn == null
194
                || tagLn == null
191
		|| matchUri == null
195
                || matchUri == null
192
		|| matchLn == null)
196
                || matchLn == null) {
193
	    return false;
197
            return false;
198
        }
194
        // match beginning of URI since some suffix *_rt tags can
199
        // match beginning of URI since some suffix *_rt tags can
195
        // be nested in EL enabled tags as defined by the spec
200
        // be nested in EL enabled tags as defined by the spec
196
        if (tagUri.length() > matchUri.length()) {
201
        if (tagUri.length() > matchUri.length()) {
Lines 204-230 Link Here
204
        return isTag(tagUri, tagLn, JSP, target);
209
        return isTag(tagUri, tagLn, JSP, target);
205
    }
210
    }
206
211
207
    private boolean isTag( int type, String tagUri, String tagLn, String target) {
212
    private boolean isTag(int type, String tagUri, String tagLn, String target) {
208
        return ( this.tlvType == type && isTag(tagUri, tagLn, this.uri, target) );
213
        return (this.tlvType == type && isTag(tagUri, tagLn, this.uri, target));
209
    }
214
    }
210
215
211
    protected boolean isCoreTag(String tagUri, String tagLn, String target) {
216
    protected boolean isCoreTag(String tagUri, String tagLn, String target) {
212
	return isTag( TYPE_CORE, tagUri, tagLn, target );
217
        return isTag(TYPE_CORE, tagUri, tagLn, target);
213
    }
218
    }
214
219
215
    protected boolean isFmtTag(String tagUri, String tagLn, String target) {
220
    protected boolean isFmtTag(String tagUri, String tagLn, String target) {
216
	return isTag( TYPE_FMT, tagUri, tagLn, target );
221
        return isTag(TYPE_FMT, tagUri, tagLn, target);
217
    }
222
    }
218
223
219
    protected boolean isSqlTag(String tagUri, String tagLn, String target) {
224
    protected boolean isSqlTag(String tagUri, String tagLn, String target) {
220
	return isTag( TYPE_SQL, tagUri, tagLn, target );
225
        return isTag(TYPE_SQL, tagUri, tagLn, target);
221
    }
226
    }
222
227
223
    protected boolean isXmlTag(String tagUri, String tagLn, String target) {
228
    protected boolean isXmlTag(String tagUri, String tagLn, String target) {
224
	return isTag( TYPE_XML, tagUri, tagLn, target );
229
        return isTag(TYPE_XML, tagUri, tagLn, target);
225
    }
230
    }
226
231
227
    // utility method to determine if an attribute exists
232
    // utility method to determine if an attribute exists
233
228
    protected boolean hasAttribute(Attributes a, String att) {
234
    protected boolean hasAttribute(Attributes a, String att) {
229
        return (a.getValue(att) != null);
235
        return (a.getValue(att) != null);
230
    }
236
    }
Lines 233-323 Link Here
233
     * method to assist with failure [ as if it's not easy enough
239
     * method to assist with failure [ as if it's not easy enough
234
     * already :-) ]
240
     * already :-) ]
235
     */
241
     */
242
236
    protected void fail(String message) {
243
    protected void fail(String message) {
237
        failed = true;
244
        failed = true;
238
        messageVector.add(new ValidationMessage(lastElementId, message));
245
        messageVector.add(new ValidationMessage(lastElementId, message));
239
    }
246
    }
240
247
241
    // returns true if the given attribute name is specified, false otherwise
248
    // returns true if the given attribute name is specified, false otherwise
249
242
    protected boolean isSpecified(TagData data, String attributeName) {
250
    protected boolean isSpecified(TagData data, String attributeName) {
243
        return (data.getAttribute(attributeName) != null);
251
        return (data.getAttribute(attributeName) != null);
244
    }
252
    }
245
253
246
    // returns true if the 'scope' attribute is valid
254
    // returns true if the 'scope' attribute is valid
255
247
    protected boolean hasNoInvalidScope(Attributes a) {
256
    protected boolean hasNoInvalidScope(Attributes a) {
248
        String scope = a.getValue(SCOPE);
257
        String scope = a.getValue(SCOPE);
249
258
250
	if ((scope != null)
259
        if ((scope != null)
251
	    && !scope.equals(PAGE_SCOPE)
260
                && !scope.equals(PAGE_SCOPE)
252
	    && !scope.equals(REQUEST_SCOPE)
261
                && !scope.equals(REQUEST_SCOPE)
253
	    && !scope.equals(SESSION_SCOPE)
262
                && !scope.equals(SESSION_SCOPE)
254
	    && !scope.equals(APPLICATION_SCOPE))
263
                && !scope.equals(APPLICATION_SCOPE)) {
255
	    return false;
264
            return false;
265
        }
256
266
257
        return true;
267
        return true;
258
    }
268
    }
259
269
260
    // returns true if the 'var' attribute is empty
270
    // returns true if the 'var' attribute is empty
271
261
    protected boolean hasEmptyVar(Attributes a) {
272
    protected boolean hasEmptyVar(Attributes a) {
262
	if ("".equals(a.getValue(VAR)))
273
        if ("".equals(a.getValue(VAR))) {
263
	    return true;
274
            return true;
264
	return false;
275
        }
276
        return false;
265
    }
277
    }
266
278
267
    // returns true if the 'scope' attribute is present without 'var'
279
    // returns true if the 'scope' attribute is present without 'var'
280
268
    protected boolean hasDanglingScope(Attributes a) {
281
    protected boolean hasDanglingScope(Attributes a) {
269
	return (a.getValue(SCOPE) != null && a.getValue(VAR) == null);
282
        return (a.getValue(SCOPE) != null && a.getValue(VAR) == null);
270
    }
283
    }
271
284
272
    // retrieves the local part of a QName
285
    // retrieves the local part of a QName
286
273
    protected String getLocalPart(String qname) {
287
    protected String getLocalPart(String qname) {
274
	int colon = qname.indexOf(":");
288
        int colon = qname.indexOf(":");
275
	if (colon == -1)
289
        if (colon == -1) {
276
	    return qname;
290
            return qname;
277
	else
291
        } else {
278
	    return qname.substring(colon + 1);
292
            return qname.substring(colon + 1);
293
        }
279
    }
294
    }
280
295
281
    //*********************************************************************
296
    //*********************************************************************
282
    // Miscellaneous utility functions
297
    // Miscellaneous utility functions
283
298
284
    // parses our configuration parameter for element:attribute pairs
299
    // parses our configuration parameter for element:attribute pairs
300
285
    private void configure(String info) {
301
    private void configure(String info) {
286
        // construct our configuration map
302
        // construct our configuration map
287
	config = new HashMap();
303
        config = new HashMap();
288
304
289
	// leave the map empty if we have nothing to configure
305
        // leave the map empty if we have nothing to configure
290
	if (info == null)
306
        if (info == null) {
291
	    return;
307
            return;
308
        }
292
309
293
	// separate parameter into space-separated tokens and store them
310
        // separate parameter into space-separated tokens and store them
294
	StringTokenizer st = new StringTokenizer(info);
311
        StringTokenizer st = new StringTokenizer(info);
295
	while (st.hasMoreTokens()) {
312
        while (st.hasMoreTokens()) {
296
	    String pair = st.nextToken();
313
            String pair = st.nextToken();
297
	    StringTokenizer pairTokens = new StringTokenizer(pair, ":");
314
            StringTokenizer pairTokens = new StringTokenizer(pair, ":");
298
	    String element = pairTokens.nextToken();
315
            String element = pairTokens.nextToken();
299
	    String attribute = pairTokens.nextToken();
316
            String attribute = pairTokens.nextToken();
300
	    Object atts = config.get(element);
317
            Object atts = config.get(element);
301
	    if (atts == null) {
318
            if (atts == null) {
302
	        atts = new HashSet();
319
                atts = new HashSet();
303
	        config.put(element, atts);
320
                config.put(element, atts);
304
	    }
321
            }
305
	    ((Set) atts).add(attribute);
322
            ((Set) atts).add(attribute);
306
	}
323
        }
307
    }
324
    }
308
325
309
    // constructs a ValidationMessage[] from a single String and no ID
326
    // constructs a ValidationMessage[] from a single String and no ID
327
310
    static ValidationMessage[] vmFromString(String message) {
328
    static ValidationMessage[] vmFromString(String message) {
311
	return new ValidationMessage[] {
329
        return new ValidationMessage[]{
312
	    new ValidationMessage(null, message)
330
                new ValidationMessage(null, message)
313
	};
331
        };
314
    }
332
    }
315
333
316
    // constructs a ValidationMessage[] from a ValidationMessage Vector
334
    // constructs a ValidationMessage[] from a ValidationMessage Vector
335
317
    static ValidationMessage[] vmFromVector(Vector v) {
336
    static ValidationMessage[] vmFromVector(Vector v) {
318
	ValidationMessage[] vm = new ValidationMessage[v.size()];
337
        ValidationMessage[] vm = new ValidationMessage[v.size()];
319
	for (int i = 0; i < vm.length; i++)
338
        for (int i = 0; i < vm.length; i++) {
320
	   vm[i] = (ValidationMessage) v.get(i);
339
            vm[i] = (ValidationMessage) v.get(i);
321
	return vm;
340
        }
341
        return vm;
322
    }
342
    }
323
}
343
}
(-)src/main/java/org/apache/taglibs/standard/functions/Functions.java (-45 / +49 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.functions;
18
package org.apache.taglibs.standard.functions;
19
19
Lines 32-43 Link Here
32
/**
32
/**
33
 * Static functions that extend the Expression Language with standardized behaviour
33
 * Static functions that extend the Expression Language with standardized behaviour
34
 * commonly used by page authors.
34
 * commonly used by page authors.
35
 *
35
 * <p/>
36
 * <strong>Implementation Note:</strong> When passing a String parameter, section
36
 * <strong>Implementation Note:</strong> When passing a String parameter, section
37
 * 1.18.2 of the EL specification requires the container to coerce a null value to an
37
 * 1.18.2 of the EL specification requires the container to coerce a null value to an
38
 * empty string. These implementation assume such behaviour and do not check for null
38
 * empty string. These implementation assume such behaviour and do not check for null
39
 * parameters. Passing a null will generally trigger a NullPointerException.
39
 * parameters. Passing a null will generally trigger a NullPointerException.
40
 * 
40
 *
41
 * @author Pierre Delisle
41
 * @author Pierre Delisle
42
 */
42
 */
43
43
Lines 67-84 Link Here
67
    public static String toLowerCase(String input) {
67
    public static String toLowerCase(String input) {
68
        return input.toLowerCase();
68
        return input.toLowerCase();
69
    }
69
    }
70
    
70
71
    //*********************************************************************
71
    //*********************************************************************
72
    // Substring processing
72
    // Substring processing
73
73
74
    /**
74
    /**
75
     * Returns the index (0-based) withing a string of the first occurrence of a specified
75
     * Returns the index (0-based) withing a string of the first occurrence of a specified
76
     * substring according to the semantics of the method <code>String#indexOf()</code>.
76
     * substring according to the semantics of the method <code>String#indexOf()</code>.
77
     *
77
     * <p/>
78
     * If <code>substring</code> is empty, this matches the beginning of the string and the
78
     * If <code>substring</code> is empty, this matches the beginning of the string and the
79
     * value returned is 0.
79
     * value returned is 0.
80
     *
80
     *
81
     * @param input the input string on which the function is applied
81
     * @param input     the input string on which the function is applied
82
     * @param substring the substring to search for in the input string
82
     * @param substring the substring to search for in the input string
83
     * @return the 0-based index of the first matching substring, or -1 if it does not occur
83
     * @return the 0-based index of the first matching substring, or -1 if it does not occur
84
     */
84
     */
Lines 89-111 Link Here
89
    /**
89
    /**
90
     * Tests if a string contains the specified substring.
90
     * Tests if a string contains the specified substring.
91
     *
91
     *
92
     * @param input the input string on which the function is applied
92
     * @param input     the input string on which the function is applied
93
     * @param substring the substring tested for
93
     * @param substring the substring tested for
94
     * @return true if the character sequence represented by the substring
94
     * @return true if the character sequence represented by the substring
95
     * exists in the string
95
     *         exists in the string
96
     */
96
     */
97
    public static boolean contains(String input, String substring) {
97
    public static boolean contains(String input, String substring) {
98
        return input.contains(substring);
98
        return input.contains(substring);
99
    }    
99
    }
100
100
101
    /**
101
    /**
102
     * Tests if a string contains the specified substring in a case insensitive way.
102
     * Tests if a string contains the specified substring in a case insensitive way.
103
     * Equivalent to <code>fn:contains(fn:toUpperCase(string), fn:toUpperCase(substring))</code>.
103
     * Equivalent to <code>fn:contains(fn:toUpperCase(string), fn:toUpperCase(substring))</code>.
104
     *
104
     *
105
     * @param input the input string on which the function is applied
105
     * @param input     the input string on which the function is applied
106
     * @param substring the substring tested for
106
     * @param substring the substring tested for
107
     * @return true if the character sequence represented by the substring
107
     * @return true if the character sequence represented by the substring
108
     * exists in the string
108
     *         exists in the string
109
     */
109
     */
110
    public static boolean containsIgnoreCase(String input, String substring) {
110
    public static boolean containsIgnoreCase(String input, String substring) {
111
        return contains(input.toUpperCase(), substring.toUpperCase());
111
        return contains(input.toUpperCase(), substring.toUpperCase());
Lines 115-133 Link Here
115
     * Tests if a string starts with the specified prefix according to the semantics
115
     * Tests if a string starts with the specified prefix according to the semantics
116
     * of <code>String#startsWith()</code>.
116
     * of <code>String#startsWith()</code>.
117
     *
117
     *
118
     * @param input the input string on which the function is applied
118
     * @param input  the input string on which the function is applied
119
     * @param prefix the prefix to be matched
119
     * @param prefix the prefix to be matched
120
     * @return true if the input string starts with the prefix
120
     * @return true if the input string starts with the prefix
121
     */
121
     */
122
    public static boolean startsWith(String input, String prefix) {
122
    public static boolean startsWith(String input, String prefix) {
123
        return input.startsWith(prefix);
123
        return input.startsWith(prefix);
124
    }    
124
    }
125
        
125
126
    /**
126
    /**
127
     * Tests if a string ends with the specified suffix according to the semantics
127
     * Tests if a string ends with the specified suffix according to the semantics
128
     * of <code>String#endsWith()</code>.
128
     * of <code>String#endsWith()</code>.
129
     *
129
     *
130
     * @param input the input string on which the function is applied
130
     * @param input  the input string on which the function is applied
131
     * @param suffix the suffix to be matched
131
     * @param suffix the suffix to be matched
132
     * @return true if the input string ends with the suffix
132
     * @return true if the input string ends with the suffix
133
     */
133
     */
Lines 145-171 Link Here
145
     * <li>if <code>endIndex < beginIndex</code>, an empty string is returned</li>
145
     * <li>if <code>endIndex < beginIndex</code>, an empty string is returned</li>
146
     * </ul>
146
     * </ul>
147
     *
147
     *
148
     * @param input the input string on which the substring function is applied
148
     * @param input      the input string on which the substring function is applied
149
     * @param beginIndex the beginning index (0-based), inclusive
149
     * @param beginIndex the beginning index (0-based), inclusive
150
     * @param endIndex the end index (0-based), exclusive
150
     * @param endIndex   the end index (0-based), exclusive
151
     * @return a subset of string
151
     * @return a subset of string
152
     */
152
     */
153
    public static String substring(String input, int beginIndex, int endIndex) {
153
    public static String substring(String input, int beginIndex, int endIndex) {
154
        if (beginIndex < 0) beginIndex = 0;
154
        if (beginIndex < 0) {
155
        if (endIndex < 0 || endIndex > input.length()) endIndex = input.length();
155
            beginIndex = 0;
156
        if (endIndex < beginIndex) return "";
156
        }
157
        if (endIndex < 0 || endIndex > input.length()) {
158
            endIndex = input.length();
159
        }
160
        if (endIndex < beginIndex) {
161
            return "";
162
        }
157
        return input.substring(beginIndex, endIndex);
163
        return input.substring(beginIndex, endIndex);
158
    }
164
    }
159
165
160
    /**
166
    /**
161
     * Returns a subset of a string following the first occurrence of a specific substring.
167
     * Returns a subset of a string following the first occurrence of a specific substring.
162
     *
168
     * <p/>
163
     * If the substring is empty, it matches the beginning of the input string and the
169
     * If the substring is empty, it matches the beginning of the input string and the
164
     * entire input string is returned. If the substring does not occur, an empty string is returned.
170
     * entire input string is returned. If the substring does not occur, an empty string is returned.
165
     *
171
     *
166
     * @param input the input string on which the substring function is applied
172
     * @param input     the input string on which the substring function is applied
167
     * @param substring the substring that delimits the beginning of the subset
173
     * @param substring the substring that delimits the beginning of the subset
168
     * of the input string to be returned
174
     *                  of the input string to be returned
169
     * @return a substring of the input string that starts at the first character after the specified substring
175
     * @return a substring of the input string that starts at the first character after the specified substring
170
     */
176
     */
171
    public static String substringAfter(String input, String substring) {
177
    public static String substringAfter(String input, String substring) {
Lines 173-191 Link Here
173
        if (index == -1) {
179
        if (index == -1) {
174
            return "";
180
            return "";
175
        } else {
181
        } else {
176
            return input.substring(index+substring.length());
182
            return input.substring(index + substring.length());
177
        }
183
        }
178
    }    
184
    }
179
        
185
180
    /**
186
    /**
181
     * Returns a subset of a string immediately before the first occurrence of a specific substring.
187
     * Returns a subset of a string immediately before the first occurrence of a specific substring.
182
     *
188
     * <p/>
183
     * If the substring is empty, it matches the beginning of the input string and an empty string is returned.
189
     * If the substring is empty, it matches the beginning of the input string and an empty string is returned.
184
     * If the substring does not occur, an empty string is returned.
190
     * If the substring does not occur, an empty string is returned.
185
     *
191
     *
186
     * @param input the input string on which the substring function is applied
192
     * @param input     the input string on which the substring function is applied
187
     * @param substring the substring that delimits the beginning of the subset
193
     * @param substring the substring that delimits the beginning of the subset
188
     * of the input string to be returned
194
     *                  of the input string to be returned
189
     * @return a substring of the input string that starts at the first character after the specified substring
195
     * @return a substring of the input string that starts at the first character after the specified substring
190
     */
196
     */
191
    public static String substringBefore(String input, String substring) {
197
    public static String substringBefore(String input, String substring) {
Lines 195-201 Link Here
195
        } else {
201
        } else {
196
            return input.substring(0, index);
202
            return input.substring(0, index);
197
        }
203
        }
198
    }    
204
    }
199
205
200
    //*********************************************************************
206
    //*********************************************************************
201
    // Character replacement
207
    // Character replacement
Lines 224-236 Link Here
224
     * Returns a string resulting from replacing all occurrences of a "before" substring with an "after" substring.
230
     * Returns a string resulting from replacing all occurrences of a "before" substring with an "after" substring.
225
     * The string is processed once and not reprocessed for further replacements.
231
     * The string is processed once and not reprocessed for further replacements.
226
     *
232
     *
227
     * @param input the string on which the replacement is to be applied
233
     * @param input  the string on which the replacement is to be applied
228
     * @param before the substring to replace
234
     * @param before the substring to replace
229
     * @param after the replacement substring
235
     * @param after  the replacement substring
230
     * @return a string with before replaced with after
236
     * @return a string with before replaced with after
231
     */
237
     */
232
    public static String replace(String input, String before, String after)
238
    public static String replace(String input, String before, String after) {
233
    {
234
        if (before.length() == 0) {
239
        if (before.length() == 0) {
235
            return input;
240
            return input;
236
        }
241
        }
Lines 242-255 Link Here
242
     * If the input string is empty, a single element array containing an empty string is returned.
247
     * If the input string is empty, a single element array containing an empty string is returned.
243
     * If the delimiters are empty, a single element array containing the input string is returned.
248
     * If the delimiters are empty, a single element array containing the input string is returned.
244
     *
249
     *
245
     * @param input the string to split
250
     * @param input      the string to split
246
     * @param delimiters characters used to split the string
251
     * @param delimiters characters used to split the string
247
     * @return an array of strings
252
     * @return an array of strings
248
     */
253
     */
249
    public static String[] split(String input, String delimiters)
254
    public static String[] split(String input, String delimiters) {
250
    {
251
        if (input.length() == 0 || delimiters.length() == 0) {
255
        if (input.length() == 0 || delimiters.length() == 0) {
252
            return new String[] { input };
256
            return new String[]{input};
253
        }
257
        }
254
258
255
        StringTokenizer tok = new StringTokenizer(input, delimiters);
259
        StringTokenizer tok = new StringTokenizer(input, delimiters);
Lines 263-274 Link Here
263
267
264
    /**
268
    /**
265
     * Joins all elements of an array into a string.
269
     * Joins all elements of an array into a string.
266
     *
270
     * <p/>
267
     * <strong>Implementation Note</strong>: The specification does not define what happens when
271
     * <strong>Implementation Note</strong>: The specification does not define what happens when
268
     * elements in the array are null. For compatibility with previous implementations, the string
272
     * elements in the array are null. For compatibility with previous implementations, the string
269
     * "null" is used although EL conventions would suggest an empty string might be better.
273
     * "null" is used although EL conventions would suggest an empty string might be better.
270
     *
274
     *
271
     * @param array an array of strings to be joined
275
     * @param array     an array of strings to be joined
272
     * @param separator used to separate the joined strings
276
     * @param separator used to separate the joined strings
273
     * @return all array elements joined into one string with the specified separator
277
     * @return all array elements joined into one string with the specified separator
274
     */
278
     */
Lines 304-310 Link Here
304
        if (obj == null) {
308
        if (obj == null) {
305
            return 0;
309
            return 0;
306
        }
310
        }
307
        
311
308
        if (obj instanceof String) {
312
        if (obj instanceof String) {
309
            return ((String) obj).length();
313
            return ((String) obj).length();
310
        }
314
        }
Lines 316-330 Link Here
316
        }
320
        }
317
        if (obj instanceof Iterator) {
321
        if (obj instanceof Iterator) {
318
            int count = 0;
322
            int count = 0;
319
            Iterator iter = (Iterator)obj;
323
            Iterator iter = (Iterator) obj;
320
            while (iter.hasNext()) {
324
            while (iter.hasNext()) {
321
                count++;
325
                count++;
322
                iter.next();
326
                iter.next();
323
            }
327
            }
324
            return count;
328
            return count;
325
        }            
329
        }
326
        if (obj instanceof Enumeration) {
330
        if (obj instanceof Enumeration) {
327
            Enumeration enum_ = (Enumeration)obj;
331
            Enumeration enum_ = (Enumeration) obj;
328
            int count = 0;
332
            int count = 0;
329
            while (enum_.hasMoreElements()) {
333
            while (enum_.hasMoreElements()) {
330
                count++;
334
                count++;
Lines 336-340 Link Here
336
            return Array.getLength(obj);
340
            return Array.getLength(obj);
337
        }
341
        }
338
        throw new JspTagException(Resources.getMessage("PARAM_BAD_VALUE"));
342
        throw new JspTagException(Resources.getMessage("PARAM_BAD_VALUE"));
339
    }      
343
    }
340
}
344
}
(-)src/main/java/org/apache/taglibs/standard/tag/rt/sql/QueryTag.java (-6 / +6 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
package org.apache.taglibs.standard.tag.rt.sql;
17
package org.apache.taglibs.standard.tag.rt.sql;
18
18
19
import org.apache.taglibs.standard.tag.common.sql.QueryTagSupport;
19
import org.apache.taglibs.standard.tag.common.sql.QueryTagSupport;
Lines 40-49 Link Here
40
40
41
    //*********************************************************************
41
    //*********************************************************************
42
    // Accessor methods
42
    // Accessor methods
43
    
43
44
    public void setDataSource(Object dataSource) {
44
    public void setDataSource(Object dataSource) {
45
	this.rawDataSource = dataSource;
45
        this.rawDataSource = dataSource;
46
	this.dataSourceSpecified = true;
46
        this.dataSourceSpecified = true;
47
    }
47
    }
48
48
49
    /**
49
    /**
Lines 60-66 Link Here
60
     */
60
     */
61
    public void setMaxRows(int maxRows) {
61
    public void setMaxRows(int maxRows) {
62
        this.maxRows = maxRows;
62
        this.maxRows = maxRows;
63
	this.maxRowsSpecified = true;
63
        this.maxRowsSpecified = true;
64
    }
64
    }
65
65
66
    /**
66
    /**
Lines 70-76 Link Here
70
     * be set using nested value elements.
70
     * be set using nested value elements.
71
     */
71
     */
72
    public void setSql(String sql) {
72
    public void setSql(String sql) {
73
	this.sql = sql;
73
        this.sql = sql;
74
    }
74
    }
75
75
76
}
76
}
(-)src/main/java/org/apache/taglibs/standard/tag/rt/sql/TransactionTag.java (-7 / +8 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
package org.apache.taglibs.standard.tag.rt.sql;
17
package org.apache.taglibs.standard.tag.rt.sql;
18
18
19
import javax.servlet.jsp.JspException;
19
import javax.servlet.jsp.JspException;
Lines 27-33 Link Here
27
 */
27
 */
28
public class TransactionTag extends TransactionTagSupport {
28
public class TransactionTag extends TransactionTagSupport {
29
    private String isolationRT;
29
    private String isolationRT;
30
    
30
31
    //*********************************************************************
31
    //*********************************************************************
32
    // Accessor methods
32
    // Accessor methods
33
33
Lines 37-44 Link Here
37
     * a String or a DataSource object.
37
     * a String or a DataSource object.
38
     */
38
     */
39
    public void setDataSource(Object dataSource) {
39
    public void setDataSource(Object dataSource) {
40
	this.rawDataSource = dataSource;
40
        this.rawDataSource = dataSource;
41
	this.dataSourceSpecified = true;
41
        this.dataSourceSpecified = true;
42
    }
42
    }
43
43
44
    /**
44
    /**
Lines 46-58 Link Here
46
     */
46
     */
47
    @Override
47
    @Override
48
    public void setIsolation(String isolation) {
48
    public void setIsolation(String isolation) {
49
	this.isolationRT = isolation;
49
        this.isolationRT = isolation;
50
    }
50
    }
51
51
52
    @Override
52
    @Override
53
    public int doStartTag() throws JspException {
53
    public int doStartTag() throws JspException {
54
	if (isolationRT != null)
54
        if (isolationRT != null) {
55
          super.setIsolation(isolationRT);
55
            super.setIsolation(isolationRT);
56
        }
56
        return super.doStartTag();
57
        return super.doStartTag();
57
    }
58
    }
58
}
59
}
(-)src/main/java/org/apache/taglibs/standard/tag/rt/sql/SetDataSourceTag.java (-8 / +7 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tag.rt.sql;
18
package org.apache.taglibs.standard.tag.rt.sql;
19
19
Lines 22-28 Link Here
22
/**
22
/**
23
 * <p>Tag handler for &lt;Driver&gt; in JSTL, used to create
23
 * <p>Tag handler for &lt;Driver&gt; in JSTL, used to create
24
 * a simple DataSource for prototyping.</p>
24
 * a simple DataSource for prototyping.</p>
25
 * 
26
 */
25
 */
27
public class SetDataSourceTag extends SetDataSourceTagSupport {
26
public class SetDataSourceTag extends SetDataSourceTagSupport {
28
27
Lines 30-53 Link Here
30
    // Accessor methods
29
    // Accessor methods
31
30
32
    public void setDataSource(Object dataSource) {
31
    public void setDataSource(Object dataSource) {
33
	this.dataSource = dataSource;
32
        this.dataSource = dataSource;
34
	this.dataSourceSpecified = true;
33
        this.dataSourceSpecified = true;
35
    }
34
    }
36
35
37
    public void setDriver(String driverClassName) {
36
    public void setDriver(String driverClassName) {
38
	this.driverClassName = driverClassName;
37
        this.driverClassName = driverClassName;
39
    }
38
    }
40
39
41
    public void setUrl(String jdbcURL) {
40
    public void setUrl(String jdbcURL) {
42
	this.jdbcURL = jdbcURL;
41
        this.jdbcURL = jdbcURL;
43
    }
42
    }
44
43
45
    public void setUser(String userName) {
44
    public void setUser(String userName) {
46
	this.userName = userName;
45
        this.userName = userName;
47
    }
46
    }
48
47
49
    public void setPassword(String password) {
48
    public void setPassword(String password) {
50
	this.password = password;
49
        this.password = password;
51
    }
50
    }
52
51
53
}
52
}
(-)src/main/java/org/apache/taglibs/standard/tag/rt/sql/DateParamTag.java (-4 / +4 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
package org.apache.taglibs.standard.tag.rt.sql;
17
package org.apache.taglibs.standard.tag.rt.sql;
18
18
19
import java.util.Date;
19
import java.util.Date;
Lines 26-37 Link Here
26
 * @author Justyna Horwat
26
 * @author Justyna Horwat
27
 */
27
 */
28
public class DateParamTag extends DateParamTagSupport {
28
public class DateParamTag extends DateParamTagSupport {
29
    
29
30
    public void setValue(Date value) {
30
    public void setValue(Date value) {
31
	this.value = value;
31
        this.value = value;
32
    }
32
    }
33
33
34
    public void setType(String type) {
34
    public void setType(String type) {
35
	this.type = type;
35
        this.type = type;
36
    }
36
    }
37
}
37
}
(-)src/main/java/org/apache/taglibs/standard/tag/rt/sql/ParamTag.java (-3 / +3 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
package org.apache.taglibs.standard.tag.rt.sql;
17
package org.apache.taglibs.standard.tag.rt.sql;
18
18
19
import org.apache.taglibs.standard.tag.common.sql.ParamTagSupport;
19
import org.apache.taglibs.standard.tag.common.sql.ParamTagSupport;
Lines 24-31 Link Here
24
 * @author Hans Bergsten
24
 * @author Hans Bergsten
25
 */
25
 */
26
public class ParamTag extends ParamTagSupport {
26
public class ParamTag extends ParamTagSupport {
27
    
27
28
    public void setValue(Object value) {
28
    public void setValue(Object value) {
29
	this.value = value;
29
        this.value = value;
30
    }
30
    }
31
}
31
}
(-)src/main/java/org/apache/taglibs/standard/tag/rt/sql/UpdateTag.java (-5 / +5 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
package org.apache.taglibs.standard.tag.rt.sql;
17
package org.apache.taglibs.standard.tag.rt.sql;
18
18
19
import org.apache.taglibs.standard.tag.common.sql.UpdateTagSupport;
19
import org.apache.taglibs.standard.tag.common.sql.UpdateTagSupport;
Lines 28-41 Link Here
28
    //*********************************************************************
28
    //*********************************************************************
29
    // Accessor methods
29
    // Accessor methods
30
30
31
    
31
32
    /**
32
    /**
33
     * Setter method for the SQL DataSource. DataSource can be
33
     * Setter method for the SQL DataSource. DataSource can be
34
     * a String or a DataSource object.
34
     * a String or a DataSource object.
35
     */
35
     */
36
    public void setDataSource(Object dataSource) {
36
    public void setDataSource(Object dataSource) {
37
	this.rawDataSource = dataSource;
37
        this.rawDataSource = dataSource;
38
	this.dataSourceSpecified = true;
38
        this.dataSourceSpecified = true;
39
    }
39
    }
40
40
41
    /**
41
    /**
Lines 45-50 Link Here
45
     * be set using nested value elements.
45
     * be set using nested value elements.
46
     */
46
     */
47
    public void setSql(String sql) {
47
    public void setSql(String sql) {
48
	this.sql = sql;
48
        this.sql = sql;
49
    }
49
    }
50
}
50
}
(-)src/main/java/org/apache/taglibs/standard/tag/rt/xml/ParseTag.java (-3 / +6 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tag.rt.xml;
18
package org.apache.taglibs.standard.tag.rt.xml;
19
19
Lines 36-57 Link Here
36
36
37
    // Deprecated as of JSTL 1.1
37
    // Deprecated as of JSTL 1.1
38
    // for tag attribute
38
    // for tag attribute
39
39
    public void setXml(Object xml) throws JspTagException {
40
    public void setXml(Object xml) throws JspTagException {
40
        this.xml = xml;
41
        this.xml = xml;
41
    }
42
    }
42
43
43
    // 'doc' replaces 'xml' as of JSTL 1.1
44
    // 'doc' replaces 'xml' as of JSTL 1.1
45
44
    public void setDoc(Object xml) throws JspTagException {
46
    public void setDoc(Object xml) throws JspTagException {
45
        this.xml = xml;
47
        this.xml = xml;
46
    }
48
    }
47
49
48
    public void setSystemId(String systemId) throws JspTagException {
50
    public void setSystemId(String systemId) throws JspTagException {
49
	this.systemId = systemId;
51
        this.systemId = systemId;
50
    }
52
    }
51
53
52
    // for tag attribute
54
    // for tag attribute
55
53
    public void setFilter(XMLFilter filter) throws JspTagException {
56
    public void setFilter(XMLFilter filter) throws JspTagException {
54
	this.filter = filter;
57
        this.filter = filter;
55
    }
58
    }
56
59
57
}
60
}
(-)src/main/java/org/apache/taglibs/standard/tag/rt/xml/TransformTag.java (-1 / +8 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tag.rt.xml;
18
package org.apache.taglibs.standard.tag.rt.xml;
19
19
Lines 36-46 Link Here
36
36
37
    // Deprecated as of JSTL 1.1
37
    // Deprecated as of JSTL 1.1
38
    // for tag attribute
38
    // for tag attribute
39
39
    public void setXml(Object xml) throws JspTagException {
40
    public void setXml(Object xml) throws JspTagException {
40
        setDoc(xml);
41
        setDoc(xml);
41
    }
42
    }
42
43
43
    // 'doc' replaces 'xml' as of JSTL 1.1
44
    // 'doc' replaces 'xml' as of JSTL 1.1
45
44
    public void setDoc(Object xml) throws JspTagException {
46
    public void setDoc(Object xml) throws JspTagException {
45
        this.xml = xml;
47
        this.xml = xml;
46
        this.xmlSpecified = true;
48
        this.xmlSpecified = true;
Lines 48-73 Link Here
48
50
49
    // Deprecated as of JSTL 1.1
51
    // Deprecated as of JSTL 1.1
50
    // for tag attribute
52
    // for tag attribute
53
51
    public void setXmlSystemId(String xmlSystemId) throws JspTagException {
54
    public void setXmlSystemId(String xmlSystemId) throws JspTagException {
52
        this.xmlSystemId = xmlSystemId;
55
        this.xmlSystemId = xmlSystemId;
53
    }
56
    }
54
57
55
    // 'docSystemId' replaces 'xmlSystemId' as of JSTL 1.1
58
    // 'docSystemId' replaces 'xmlSystemId' as of JSTL 1.1
59
56
    public void setDocSystemId(String xmlSystemId) throws JspTagException {
60
    public void setDocSystemId(String xmlSystemId) throws JspTagException {
57
        this.xmlSystemId = xmlSystemId;
61
        this.xmlSystemId = xmlSystemId;
58
    }
62
    }
59
63
60
    // for tag attribute
64
    // for tag attribute
65
61
    public void setXslt(Object xslt) throws JspTagException {
66
    public void setXslt(Object xslt) throws JspTagException {
62
        this.xslt = xslt;
67
        this.xslt = xslt;
63
    }
68
    }
64
69
65
    // for tag attribute
70
    // for tag attribute
71
66
    public void setXsltSystemId(String xsltSystemId) throws JspTagException {
72
    public void setXsltSystemId(String xsltSystemId) throws JspTagException {
67
        this.xsltSystemId = xsltSystemId;
73
        this.xsltSystemId = xsltSystemId;
68
    }
74
    }
69
75
70
    // for tag attribute
76
    // for tag attribute
77
71
    public void setResult(Result result) throws JspTagException {
78
    public void setResult(Result result) throws JspTagException {
72
        this.result = result;
79
        this.result = result;
73
    }
80
    }
(-)src/main/java/org/apache/taglibs/standard/tag/rt/xml/ExprTag.java (-2 / +3 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tag.rt.xml;
18
package org.apache.taglibs.standard.tag.rt.xml;
19
19
Lines 32-39 Link Here
32
    // Accessor methods
32
    // Accessor methods
33
33
34
    // for tag attribute
34
    // for tag attribute
35
35
    public void setEscapeXml(boolean escapeXml) {
36
    public void setEscapeXml(boolean escapeXml) {
36
      this.escapeXml = escapeXml;
37
        this.escapeXml = escapeXml;
37
    }
38
    }
38
39
39
}
40
}
(-)src/main/java/org/apache/taglibs/standard/tag/rt/xml/ParamTag.java (-1 / +3 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tag.rt.xml;
18
package org.apache.taglibs.standard.tag.rt.xml;
19
19
Lines 34-44 Link Here
34
    // Accessor methods
34
    // Accessor methods
35
35
36
    // for tag attribute
36
    // for tag attribute
37
37
    public void setName(String name) throws JspTagException {
38
    public void setName(String name) throws JspTagException {
38
        this.name = name;
39
        this.name = name;
39
    }
40
    }
40
41
41
    // for tag attribute
42
    // for tag attribute
43
42
    public void setValue(Object value) throws JspTagException {
44
    public void setValue(Object value) throws JspTagException {
43
        this.value = value;
45
        this.value = value;
44
    }
46
    }
(-)src/main/java/org/apache/taglibs/standard/tag/rt/fmt/ParseNumberTag.java (-13 / +18 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tag.rt.fmt;
18
package org.apache.taglibs.standard.tag.rt.fmt;
19
19
Lines 37-74 Link Here
37
    // Accessor methods
37
    // Accessor methods
38
38
39
    // 'value' attribute
39
    // 'value' attribute
40
40
    public void setValue(String value) throws JspTagException {
41
    public void setValue(String value) throws JspTagException {
41
        this.value = value;
42
        this.value = value;
42
	this.valueSpecified = true;
43
        this.valueSpecified = true;
43
    }
44
    }
44
45
45
    // 'type' attribute
46
    // 'type' attribute
47
46
    public void setType(String type) throws JspTagException {
48
    public void setType(String type) throws JspTagException {
47
        this.type = type;
49
        this.type = type;
48
    }
50
    }
49
51
50
    // 'pattern' attribute
52
    // 'pattern' attribute
53
51
    public void setPattern(String pattern) throws JspTagException {
54
    public void setPattern(String pattern) throws JspTagException {
52
        this.pattern = pattern;
55
        this.pattern = pattern;
53
    }
56
    }
54
57
55
    // 'parseLocale' attribute
58
    // 'parseLocale' attribute
59
56
    public void setParseLocale(Object loc) throws JspTagException {
60
    public void setParseLocale(Object loc) throws JspTagException {
57
	if (loc != null) {
61
        if (loc != null) {
58
	    if (loc instanceof Locale) {
62
            if (loc instanceof Locale) {
59
		this.parseLocale = (Locale) loc;
63
                this.parseLocale = (Locale) loc;
60
	    } else {
64
            } else {
61
		if (!"".equals((String) loc)) {
65
                if (!"".equals((String) loc)) {
62
		    this.parseLocale = SetLocaleSupport.parseLocale((String)
66
                    this.parseLocale = SetLocaleSupport.parseLocale((String)
63
								    loc);
67
                            loc);
64
		}
68
                }
65
	    }
69
            }
66
	}
70
        }
67
    }
71
    }
68
72
69
    // 'integerOnly' attribute
73
    // 'integerOnly' attribute
74
70
    public void setIntegerOnly(boolean isIntegerOnly) throws JspTagException {
75
    public void setIntegerOnly(boolean isIntegerOnly) throws JspTagException {
71
        this.isIntegerOnly = isIntegerOnly;
76
        this.isIntegerOnly = isIntegerOnly;
72
	this.integerOnlySpecified = true;
77
        this.integerOnlySpecified = true;
73
    }
78
    }
74
}
79
}
(-)src/main/java/org/apache/taglibs/standard/tag/rt/fmt/MessageTag.java (-2 / +4 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tag.rt.fmt;
18
package org.apache.taglibs.standard.tag.rt.fmt;
19
19
Lines 35-46 Link Here
35
    // Accessor methods
35
    // Accessor methods
36
36
37
    // for tag attribute
37
    // for tag attribute
38
38
    public void setKey(String key) throws JspTagException {
39
    public void setKey(String key) throws JspTagException {
39
        this.keyAttrValue = key;
40
        this.keyAttrValue = key;
40
	this.keySpecified = true;
41
        this.keySpecified = true;
41
    }
42
    }
42
43
43
    // for tag attribute
44
    // for tag attribute
45
44
    public void setBundle(LocalizationContext locCtxt) throws JspTagException {
46
    public void setBundle(LocalizationContext locCtxt) throws JspTagException {
45
        this.bundleAttrValue = locCtxt;
47
        this.bundleAttrValue = locCtxt;
46
        this.bundleSpecified = true;
48
        this.bundleSpecified = true;
(-)src/main/java/org/apache/taglibs/standard/tag/rt/fmt/SetBundleTag.java (-1 / +2 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tag.rt.fmt;
18
package org.apache.taglibs.standard.tag.rt.fmt;
19
19
Lines 34-39 Link Here
34
    // Accessor methods
34
    // Accessor methods
35
35
36
    // for tag attribute
36
    // for tag attribute
37
37
    public void setBasename(String basename) throws JspTagException {
38
    public void setBasename(String basename) throws JspTagException {
38
        this.basename = basename;
39
        this.basename = basename;
39
    }
40
    }
(-)src/main/java/org/apache/taglibs/standard/tag/rt/fmt/FormatDateTag.java (-1 / +7 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tag.rt.fmt;
18
package org.apache.taglibs.standard.tag.rt.fmt;
19
19
Lines 36-66 Link Here
36
    // Accessor methods
36
    // Accessor methods
37
37
38
    // 'value' attribute
38
    // 'value' attribute
39
39
    public void setValue(Date value) throws JspTagException {
40
    public void setValue(Date value) throws JspTagException {
40
        this.value = value;
41
        this.value = value;
41
    }
42
    }
42
43
43
    // 'type' attribute
44
    // 'type' attribute
45
44
    public void setType(String type) throws JspTagException {
46
    public void setType(String type) throws JspTagException {
45
        this.type = type;
47
        this.type = type;
46
    }
48
    }
47
49
48
    // 'dateStyle' attribute
50
    // 'dateStyle' attribute
51
49
    public void setDateStyle(String dateStyle) throws JspTagException {
52
    public void setDateStyle(String dateStyle) throws JspTagException {
50
        this.dateStyle = dateStyle;
53
        this.dateStyle = dateStyle;
51
    }
54
    }
52
55
53
    // 'timeStyle' attribute
56
    // 'timeStyle' attribute
57
54
    public void setTimeStyle(String timeStyle) throws JspTagException {
58
    public void setTimeStyle(String timeStyle) throws JspTagException {
55
        this.timeStyle = timeStyle;
59
        this.timeStyle = timeStyle;
56
    }
60
    }
57
61
58
    // 'pattern' attribute
62
    // 'pattern' attribute
63
59
    public void setPattern(String pattern) throws JspTagException {
64
    public void setPattern(String pattern) throws JspTagException {
60
        this.pattern = pattern;
65
        this.pattern = pattern;
61
    }
66
    }
62
67
63
    // 'timeZone' attribute
68
    // 'timeZone' attribute
69
64
    public void setTimeZone(Object timeZone) throws JspTagException {
70
    public void setTimeZone(Object timeZone) throws JspTagException {
65
        this.timeZone = timeZone;
71
        this.timeZone = timeZone;
66
    }
72
    }
(-)src/main/java/org/apache/taglibs/standard/tag/rt/fmt/SetTimeZoneTag.java (-1 / +2 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tag.rt.fmt;
18
package org.apache.taglibs.standard.tag.rt.fmt;
19
19
Lines 34-39 Link Here
34
    // Accessor methods
34
    // Accessor methods
35
35
36
    // for tag attribute
36
    // for tag attribute
37
37
    public void setValue(Object value) throws JspTagException {
38
    public void setValue(Object value) throws JspTagException {
38
        this.value = value;
39
        this.value = value;
39
    }
40
    }
(-)src/main/java/org/apache/taglibs/standard/tag/rt/fmt/ParseDateTag.java (-12 / +19 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tag.rt.fmt;
18
package org.apache.taglibs.standard.tag.rt.fmt;
19
19
Lines 37-83 Link Here
37
    // Accessor methods
37
    // Accessor methods
38
38
39
    // 'value' attribute
39
    // 'value' attribute
40
40
    public void setValue(String value) throws JspTagException {
41
    public void setValue(String value) throws JspTagException {
41
        this.value = value;
42
        this.value = value;
42
	this.valueSpecified = true;
43
        this.valueSpecified = true;
43
    }
44
    }
44
45
45
    // 'type' attribute
46
    // 'type' attribute
47
46
    public void setType(String type) throws JspTagException {
48
    public void setType(String type) throws JspTagException {
47
        this.type = type;
49
        this.type = type;
48
    }
50
    }
49
51
50
    // 'dateStyle' attribute
52
    // 'dateStyle' attribute
53
51
    public void setDateStyle(String dateStyle) throws JspTagException {
54
    public void setDateStyle(String dateStyle) throws JspTagException {
52
        this.dateStyle = dateStyle;
55
        this.dateStyle = dateStyle;
53
    }
56
    }
54
57
55
    // 'timeStyle' attribute
58
    // 'timeStyle' attribute
59
56
    public void setTimeStyle(String timeStyle) throws JspTagException {
60
    public void setTimeStyle(String timeStyle) throws JspTagException {
57
        this.timeStyle = timeStyle;
61
        this.timeStyle = timeStyle;
58
    }
62
    }
59
63
60
    // 'pattern' attribute
64
    // 'pattern' attribute
65
61
    public void setPattern(String pattern) throws JspTagException {
66
    public void setPattern(String pattern) throws JspTagException {
62
        this.pattern = pattern;
67
        this.pattern = pattern;
63
    }
68
    }
64
69
65
    // 'timeZone' attribute
70
    // 'timeZone' attribute
71
66
    public void setTimeZone(Object timeZone) throws JspTagException {
72
    public void setTimeZone(Object timeZone) throws JspTagException {
67
        this.timeZone = timeZone;
73
        this.timeZone = timeZone;
68
    }
74
    }
69
75
70
    // 'parseLocale' attribute
76
    // 'parseLocale' attribute
77
71
    public void setParseLocale(Object loc) throws JspTagException {
78
    public void setParseLocale(Object loc) throws JspTagException {
72
	if (loc != null) {
79
        if (loc != null) {
73
	    if (loc instanceof Locale) {
80
            if (loc instanceof Locale) {
74
		this.parseLocale = (Locale) loc;
81
                this.parseLocale = (Locale) loc;
75
	    } else {
82
            } else {
76
		if (!"".equals((String) loc)) {
83
                if (!"".equals((String) loc)) {
77
		    this.parseLocale = SetLocaleSupport.parseLocale((String)
84
                    this.parseLocale = SetLocaleSupport.parseLocale((String)
78
								    loc);
85
                            loc);
79
		}
86
                }
80
	    }
87
            }
81
	}
88
        }
82
    }
89
    }
83
}
90
}
(-)src/main/java/org/apache/taglibs/standard/tag/rt/fmt/BundleTag.java (-1 / +3 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tag.rt.fmt;
18
package org.apache.taglibs.standard.tag.rt.fmt;
19
19
Lines 34-44 Link Here
34
    // Accessor methods
34
    // Accessor methods
35
35
36
    // for tag attribute
36
    // for tag attribute
37
37
    public void setBasename(String basename) throws JspTagException {
38
    public void setBasename(String basename) throws JspTagException {
38
        this.basename = basename;
39
        this.basename = basename;
39
    }
40
    }
40
41
41
    // for tag attribute
42
    // for tag attribute
43
42
    public void setPrefix(String prefix) throws JspTagException {
44
    public void setPrefix(String prefix) throws JspTagException {
43
        this.prefix = prefix;
45
        this.prefix = prefix;
44
    }
46
    }
(-)src/main/java/org/apache/taglibs/standard/tag/rt/fmt/TimeZoneTag.java (-1 / +2 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tag.rt.fmt;
18
package org.apache.taglibs.standard.tag.rt.fmt;
19
19
Lines 34-39 Link Here
34
    // Accessor methods
34
    // Accessor methods
35
35
36
    // for tag attribute
36
    // for tag attribute
37
37
    public void setValue(Object value) throws JspTagException {
38
    public void setValue(Object value) throws JspTagException {
38
        this.value = value;
39
        this.value = value;
39
    }
40
    }
(-)src/main/java/org/apache/taglibs/standard/tag/rt/fmt/SetLocaleTag.java (-1 / +3 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tag.rt.fmt;
18
package org.apache.taglibs.standard.tag.rt.fmt;
19
19
Lines 34-44 Link Here
34
    // Accessor methods
34
    // Accessor methods
35
35
36
    // for tag attribute
36
    // for tag attribute
37
37
    public void setValue(Object value) throws JspTagException {
38
    public void setValue(Object value) throws JspTagException {
38
        this.value = value;
39
        this.value = value;
39
    }
40
    }
40
41
41
    // for tag attribute
42
    // for tag attribute
43
42
    public void setVariant(String variant) throws JspTagException {
44
    public void setVariant(String variant) throws JspTagException {
43
        this.variant = variant;
45
        this.variant = variant;
44
    }
46
    }
(-)src/main/java/org/apache/taglibs/standard/tag/rt/fmt/RequestEncodingTag.java (-1 / +2 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tag.rt.fmt;
18
package org.apache.taglibs.standard.tag.rt.fmt;
19
19
Lines 34-39 Link Here
34
    // Accessor methods
34
    // Accessor methods
35
35
36
    // for tag attribute
36
    // for tag attribute
37
37
    public void setValue(String value) throws JspTagException {
38
    public void setValue(String value) throws JspTagException {
38
        this.value = value;
39
        this.value = value;
39
    }
40
    }
(-)src/main/java/org/apache/taglibs/standard/tag/rt/fmt/ParamTag.java (-2 / +3 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tag.rt.fmt;
18
package org.apache.taglibs.standard.tag.rt.fmt;
19
19
Lines 34-41 Link Here
34
    // Accessor methods
34
    // Accessor methods
35
35
36
    // for tag attribute
36
    // for tag attribute
37
37
    public void setValue(Object value) throws JspTagException {
38
    public void setValue(Object value) throws JspTagException {
38
        this.value = value;
39
        this.value = value;
39
	this.valueSpecified = true;
40
        this.valueSpecified = true;
40
    }
41
    }
41
}
42
}
(-)src/main/java/org/apache/taglibs/standard/tag/rt/fmt/FormatNumberTag.java (-9 / +19 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tag.rt.fmt;
18
package org.apache.taglibs.standard.tag.rt.fmt;
19
19
Lines 34-93 Link Here
34
    // Accessor methods
34
    // Accessor methods
35
35
36
    // 'value' attribute
36
    // 'value' attribute
37
37
    public void setValue(Object value) throws JspTagException {
38
    public void setValue(Object value) throws JspTagException {
38
        this.value = value;
39
        this.value = value;
39
	this.valueSpecified = true;
40
        this.valueSpecified = true;
40
    }
41
    }
41
42
42
    // 'type' attribute
43
    // 'type' attribute
44
43
    public void setType(String type) throws JspTagException {
45
    public void setType(String type) throws JspTagException {
44
        this.type = type;
46
        this.type = type;
45
    }
47
    }
46
48
47
    // 'pattern' attribute
49
    // 'pattern' attribute
50
48
    public void setPattern(String pattern) throws JspTagException {
51
    public void setPattern(String pattern) throws JspTagException {
49
        this.pattern = pattern;
52
        this.pattern = pattern;
50
    }
53
    }
51
54
52
    // 'currencyCode' attribute
55
    // 'currencyCode' attribute
56
53
    public void setCurrencyCode(String currencyCode) throws JspTagException {
57
    public void setCurrencyCode(String currencyCode) throws JspTagException {
54
        this.currencyCode = currencyCode;
58
        this.currencyCode = currencyCode;
55
    }
59
    }
56
60
57
    // 'currencySymbol' attribute
61
    // 'currencySymbol' attribute
62
58
    public void setCurrencySymbol(String currencySymbol)
63
    public void setCurrencySymbol(String currencySymbol)
59
	throws JspTagException {
64
            throws JspTagException {
60
        this.currencySymbol = currencySymbol;
65
        this.currencySymbol = currencySymbol;
61
    }
66
    }
62
67
63
    // 'groupingUsed' attribute
68
    // 'groupingUsed' attribute
69
64
    public void setGroupingUsed(boolean isGroupingUsed)
70
    public void setGroupingUsed(boolean isGroupingUsed)
65
	throws JspTagException {
71
            throws JspTagException {
66
        this.isGroupingUsed = isGroupingUsed;
72
        this.isGroupingUsed = isGroupingUsed;
67
	this.groupingUsedSpecified = true;
73
        this.groupingUsedSpecified = true;
68
    }
74
    }
69
75
70
    // 'maxIntegerDigits' attribute
76
    // 'maxIntegerDigits' attribute
77
71
    public void setMaxIntegerDigits(int maxDigits) throws JspTagException {
78
    public void setMaxIntegerDigits(int maxDigits) throws JspTagException {
72
        this.maxIntegerDigits = maxDigits;
79
        this.maxIntegerDigits = maxDigits;
73
	this.maxIntegerDigitsSpecified = true;
80
        this.maxIntegerDigitsSpecified = true;
74
    }
81
    }
75
82
76
    // 'minIntegerDigits' attribute
83
    // 'minIntegerDigits' attribute
84
77
    public void setMinIntegerDigits(int minDigits) throws JspTagException {
85
    public void setMinIntegerDigits(int minDigits) throws JspTagException {
78
        this.minIntegerDigits = minDigits;
86
        this.minIntegerDigits = minDigits;
79
	this.minIntegerDigitsSpecified = true;
87
        this.minIntegerDigitsSpecified = true;
80
    }
88
    }
81
89
82
    // 'maxFractionDigits' attribute
90
    // 'maxFractionDigits' attribute
91
83
    public void setMaxFractionDigits(int maxDigits) throws JspTagException {
92
    public void setMaxFractionDigits(int maxDigits) throws JspTagException {
84
        this.maxFractionDigits = maxDigits;
93
        this.maxFractionDigits = maxDigits;
85
	this.maxFractionDigitsSpecified = true;
94
        this.maxFractionDigitsSpecified = true;
86
    }
95
    }
87
96
88
    // 'minFractionDigits' attribute
97
    // 'minFractionDigits' attribute
98
89
    public void setMinFractionDigits(int minDigits) throws JspTagException {
99
    public void setMinFractionDigits(int minDigits) throws JspTagException {
90
        this.minFractionDigits = minDigits;
100
        this.minFractionDigits = minDigits;
91
	this.minFractionDigitsSpecified = true;
101
        this.minFractionDigitsSpecified = true;
92
    }
102
    }
93
}
103
}
(-)src/main/java/org/apache/taglibs/standard/tag/rt/core/ForEachTag.java (-9 / +12 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tag.rt.core;
18
package org.apache.taglibs.standard.tag.rt.core;
19
19
Lines 33-46 Link Here
33
 */
33
 */
34
34
35
public class ForEachTag
35
public class ForEachTag
36
    extends ForEachSupport
36
        extends ForEachSupport
37
    implements LoopTag, IterationTag
37
        implements LoopTag, IterationTag {
38
{
39
38
40
    //*********************************************************************
39
    //*********************************************************************
41
    // Accessor methods
40
    // Accessor methods
42
41
43
    // for tag attribute
42
    // for tag attribute
43
44
    public void setBegin(int begin) throws JspTagException {
44
    public void setBegin(int begin) throws JspTagException {
45
        this.beginSpecified = true;
45
        this.beginSpecified = true;
46
        this.begin = begin;
46
        this.begin = begin;
Lines 48-53 Link Here
48
    }
48
    }
49
49
50
    // for tag attribute
50
    // for tag attribute
51
51
    public void setEnd(int end) throws JspTagException {
52
    public void setEnd(int end) throws JspTagException {
52
        this.endSpecified = true;
53
        this.endSpecified = true;
53
        this.end = end;
54
        this.end = end;
Lines 55-60 Link Here
55
    }
56
    }
56
57
57
    // for tag attribute
58
    // for tag attribute
59
58
    public void setStep(int step) throws JspTagException {
60
    public void setStep(int step) throws JspTagException {
59
        this.stepSpecified = true;
61
        this.stepSpecified = true;
60
        this.step = step;
62
        this.step = step;
Lines 62-71 Link Here
62
    }
64
    }
63
65
64
    public void setItems(Object o) throws JspTagException {
66
    public void setItems(Object o) throws JspTagException {
65
	// for null items, simulate an empty list
67
        // for null items, simulate an empty list
66
	if (o == null)
68
        if (o == null) {
67
	    rawItems = new ArrayList();
69
            rawItems = new ArrayList();
68
        else
70
        } else {
69
	    rawItems = o;
71
            rawItems = o;
72
        }
70
    }
73
    }
71
}
74
}
(-)src/main/java/org/apache/taglibs/standard/tag/rt/core/OutTag.java (-3 / +6 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tag.rt.core;
18
package org.apache.taglibs.standard.tag.rt.core;
19
19
Lines 43-58 Link Here
43
    }
43
    }
44
44
45
    // for tag attribute
45
    // for tag attribute
46
46
    public void setValue(Object value) {
47
    public void setValue(Object value) {
47
        this.value = value;
48
        this.value = value;
48
    }
49
    }
49
      
50
50
    // for tag attribute
51
    // for tag attribute
52
51
    public void setDefault(String def) {
53
    public void setDefault(String def) {
52
        this.def = def;
54
        this.def = def;
53
    }
55
    }
54
        
56
55
    // for tag attribute
57
    // for tag attribute
58
56
    public void setEscapeXml(boolean escapeXml) {
59
    public void setEscapeXml(boolean escapeXml) {
57
        this.escapeXml = escapeXml;
60
        this.escapeXml = escapeXml;
58
    }
61
    }
(-)src/main/java/org/apache/taglibs/standard/tag/rt/core/ForTokensTag.java (-10 / +16 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tag.rt.core;
18
package org.apache.taglibs.standard.tag.rt.core;
19
19
Lines 31-44 Link Here
31
 */
31
 */
32
32
33
public class ForTokensTag
33
public class ForTokensTag
34
    extends ForTokensSupport
34
        extends ForTokensSupport
35
    implements LoopTag, IterationTag
35
        implements LoopTag, IterationTag {
36
{
37
36
38
    //*********************************************************************
37
    //*********************************************************************
39
    // Accessor methods
38
    // Accessor methods
40
39
41
    // for tag attribute
40
    // for tag attribute
41
42
    public void setBegin(int begin) throws JspTagException {
42
    public void setBegin(int begin) throws JspTagException {
43
        this.beginSpecified = true;
43
        this.beginSpecified = true;
44
        this.begin = begin;
44
        this.begin = begin;
Lines 46-51 Link Here
46
    }
46
    }
47
47
48
    // for tag attribute
48
    // for tag attribute
49
49
    public void setEnd(int end) throws JspTagException {
50
    public void setEnd(int end) throws JspTagException {
50
        this.endSpecified = true;
51
        this.endSpecified = true;
51
        this.end = end;
52
        this.end = end;
Lines 53-58 Link Here
53
    }
54
    }
54
55
55
    // for tag attribute
56
    // for tag attribute
57
56
    public void setStep(int step) throws JspTagException {
58
    public void setStep(int step) throws JspTagException {
57
        this.stepSpecified = true;
59
        this.stepSpecified = true;
58
        this.step = step;
60
        this.step = step;
Lines 60-78 Link Here
60
    }
62
    }
61
63
62
    // stores the 'items' Object we're passed
64
    // stores the 'items' Object we're passed
65
63
    public void setItems(Object s) throws JspTagException {
66
    public void setItems(Object s) throws JspTagException {
64
        items = s;
67
        items = s;
65
	// use the empty string to indicate "no iteration"
68
        // use the empty string to indicate "no iteration"
66
        if (s == null)
69
        if (s == null) {
67
	    items = "";
70
            items = "";
71
        }
68
    }
72
    }
69
73
70
    // stores the 'delims' String we're passed
74
    // stores the 'delims' String we're passed
75
71
    public void setDelims(String s) throws JspTagException {
76
    public void setDelims(String s) throws JspTagException {
72
        delims = s;
77
        delims = s;
73
	// use the empty string to cause monolithic tokenization
78
        // use the empty string to cause monolithic tokenization
74
        if (s == null)
79
        if (s == null) {
75
	    delims = "";
80
            delims = "";
81
        }
76
    }
82
    }
77
83
78
}
84
}
(-)src/main/java/org/apache/taglibs/standard/tag/rt/core/ImportTag.java (-1 / +4 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tag.rt.core;
18
package org.apache.taglibs.standard.tag.rt.core;
19
19
Lines 34-49 Link Here
34
    // Accessor methods
34
    // Accessor methods
35
35
36
    // for tag attribute
36
    // for tag attribute
37
37
    public void setUrl(String url) throws JspTagException {
38
    public void setUrl(String url) throws JspTagException {
38
        this.url = url;
39
        this.url = url;
39
    }
40
    }
40
41
41
    // for tag attribute
42
    // for tag attribute
43
42
    public void setContext(String context) throws JspTagException {
44
    public void setContext(String context) throws JspTagException {
43
        this.context = context;
45
        this.context = context;
44
    }
46
    }
45
47
46
    // for tag attribute
48
    // for tag attribute
49
47
    public void setCharEncoding(String charEncoding) throws JspTagException {
50
    public void setCharEncoding(String charEncoding) throws JspTagException {
48
        this.charEncoding = charEncoding;
51
        this.charEncoding = charEncoding;
49
    }
52
    }
(-)src/main/java/org/apache/taglibs/standard/tag/rt/core/SetTag.java (-1 / +1 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tag.rt.core;
18
package org.apache.taglibs.standard.tag.rt.core;
19
19
(-)src/main/java/org/apache/taglibs/standard/tag/rt/core/IfTag.java (-1 / +5 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tag.rt.core;
18
package org.apache.taglibs.standard.tag.rt.core;
19
19
Lines 34-45 Link Here
34
    // Constructor and lifecycle management
34
    // Constructor and lifecycle management
35
35
36
    // initialize inherited and local state
36
    // initialize inherited and local state
37
37
    public IfTag() {
38
    public IfTag() {
38
        super();
39
        super();
39
        init();
40
        init();
40
    }
41
    }
41
42
42
    // Releases any resources we may have (or inherit)
43
    // Releases any resources we may have (or inherit)
44
43
    @Override
45
    @Override
44
    public void release() {
46
    public void release() {
45
        super.release();
47
        super.release();
Lines 66-71 Link Here
66
    // Accessors
68
    // Accessors
67
69
68
    // receives the tag's 'test' attribute
70
    // receives the tag's 'test' attribute
71
69
    public void setTest(boolean test) {
72
    public void setTest(boolean test) {
70
        this.test = test;
73
        this.test = test;
71
    }
74
    }
Lines 75-80 Link Here
75
    // Private utility methods
78
    // Private utility methods
76
79
77
    // resets internal state
80
    // resets internal state
81
78
    private void init() {
82
    private void init() {
79
        test = false;
83
        test = false;
80
    }
84
    }
(-)src/main/java/org/apache/taglibs/standard/tag/rt/core/ParamTag.java (-1 / +3 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tag.rt.core;
18
package org.apache.taglibs.standard.tag.rt.core;
19
19
Lines 34-44 Link Here
34
    // Accessor methods
34
    // Accessor methods
35
35
36
    // for tag attribute
36
    // for tag attribute
37
37
    public void setName(String name) throws JspTagException {
38
    public void setName(String name) throws JspTagException {
38
        this.name = name;
39
        this.name = name;
39
    }
40
    }
40
41
41
    // for tag attribute
42
    // for tag attribute
43
42
    public void setValue(String value) throws JspTagException {
44
    public void setValue(String value) throws JspTagException {
43
        this.value = value;
45
        this.value = value;
44
    }
46
    }
(-)src/main/java/org/apache/taglibs/standard/tag/rt/core/RedirectTag.java (-1 / +3 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tag.rt.core;
18
package org.apache.taglibs.standard.tag.rt.core;
19
19
Lines 34-44 Link Here
34
    // Accessor methods
34
    // Accessor methods
35
35
36
    // for tag attribute
36
    // for tag attribute
37
37
    public void setUrl(String url) throws JspTagException {
38
    public void setUrl(String url) throws JspTagException {
38
        this.url = url;
39
        this.url = url;
39
    }
40
    }
40
41
41
    // for tag attribute
42
    // for tag attribute
43
42
    public void setContext(String context) throws JspTagException {
44
    public void setContext(String context) throws JspTagException {
43
        this.context = context;
45
        this.context = context;
44
    }
46
    }
(-)src/main/java/org/apache/taglibs/standard/tag/rt/core/WhenTag.java (-1 / +5 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tag.rt.core;
18
package org.apache.taglibs.standard.tag.rt.core;
19
19
Lines 31-42 Link Here
31
    // Constructor and lifecycle management
31
    // Constructor and lifecycle management
32
32
33
    // initialize inherited and local state
33
    // initialize inherited and local state
34
34
    public WhenTag() {
35
    public WhenTag() {
35
        super();
36
        super();
36
        init();
37
        init();
37
    }
38
    }
38
39
39
    // Releases any resources we may have (or inherit)
40
    // Releases any resources we may have (or inherit)
41
40
    @Override
42
    @Override
41
    public void release() {
43
    public void release() {
42
        super.release();
44
        super.release();
Lines 63-68 Link Here
63
    // Accessors
65
    // Accessors
64
66
65
    // receives the tag's 'test' attribute
67
    // receives the tag's 'test' attribute
68
66
    public void setTest(boolean test) {
69
    public void setTest(boolean test) {
67
        this.test = test;
70
        this.test = test;
68
    }
71
    }
Lines 72-77 Link Here
72
    // Private utility methods
75
    // Private utility methods
73
76
74
    // resets internal state
77
    // resets internal state
78
75
    private void init() {
79
    private void init() {
76
        test = false;
80
        test = false;
77
    }
81
    }
(-)src/main/java/org/apache/taglibs/standard/tag/rt/core/UrlTag.java (-1 / +3 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tag.rt.core;
18
package org.apache.taglibs.standard.tag.rt.core;
19
19
Lines 34-44 Link Here
34
    // Accessor methods
34
    // Accessor methods
35
35
36
    // for tag attribute
36
    // for tag attribute
37
37
    public void setValue(String value) throws JspTagException {
38
    public void setValue(String value) throws JspTagException {
38
        this.value = value;
39
        this.value = value;
39
    }
40
    }
40
41
41
    // for tag attribute
42
    // for tag attribute
43
42
    public void setContext(String context) throws JspTagException {
44
    public void setContext(String context) throws JspTagException {
43
        this.context = context;
45
        this.context = context;
44
    }
46
    }
(-)src/main/java/org/apache/taglibs/standard/tag/common/sql/SetDataSourceTagSupport.java (-21 / +21 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tag.common.sql;
18
package org.apache.taglibs.standard.tag.common.sql;
19
19
Lines 31-37 Link Here
31
/**
31
/**
32
 * <p>Tag handler for &lt;SetDataSource&gt; in JSTL, used to create
32
 * <p>Tag handler for &lt;SetDataSource&gt; in JSTL, used to create
33
 * a simple DataSource for prototyping.</p>
33
 * a simple DataSource for prototyping.</p>
34
 * 
34
 *
35
 * @author Hans Bergsten
35
 * @author Hans Bergsten
36
 * @author Justyna Horwat
36
 * @author Justyna Horwat
37
 */
37
 */
Lines 52-67 Link Here
52
    // Constructor and initialization
52
    // Constructor and initialization
53
53
54
    public SetDataSourceTagSupport() {
54
    public SetDataSourceTagSupport() {
55
	super();
55
        super();
56
	init();
56
        init();
57
    }
57
    }
58
58
59
    private void init() {
59
    private void init() {
60
	dataSource = null;
60
        dataSource = null;
61
	dataSourceSpecified = false;
61
        dataSourceSpecified = false;
62
	jdbcURL = driverClassName = userName = password = null;
62
        jdbcURL = driverClassName = userName = password = null;
63
	var = null;
63
        var = null;
64
	scope = PageContext.PAGE_SCOPE;
64
        scope = PageContext.PAGE_SCOPE;
65
    }
65
    }
66
66
67
67
Lines 71-84 Link Here
71
    /**
71
    /**
72
     * Setter method for the scope of the variable to hold the
72
     * Setter method for the scope of the variable to hold the
73
     * result.
73
     * result.
74
     *
75
     */
74
     */
76
    public void setScope(String scope) {
75
    public void setScope(String scope) {
77
        this.scope = Util.getScope(scope);
76
        this.scope = Util.getScope(scope);
78
    }
77
    }
79
78
80
    public void setVar(String var) {
79
    public void setVar(String var) {
81
	this.var = var;
80
        this.var = var;
82
    }
81
    }
83
82
84
83
Lines 92-101 Link Here
92
        if (dataSource != null) {
91
        if (dataSource != null) {
93
            ds = DataSourceUtil.getDataSource(dataSource, pageContext);
92
            ds = DataSourceUtil.getDataSource(dataSource, pageContext);
94
        } else {
93
        } else {
95
	    if (dataSourceSpecified) {
94
            if (dataSourceSpecified) {
96
		throw new JspException(
95
                throw new JspException(
97
                    Resources.getMessage("SQL_DATASOURCE_NULL"));
96
                        Resources.getMessage("SQL_DATASOURCE_NULL"));
98
	    }
97
            }
99
98
100
            DataSourceWrapper dsw = new DataSourceWrapper();
99
            DataSourceWrapper dsw = new DataSourceWrapper();
101
            try {
100
            try {
Lines 106-132 Link Here
106
            }
105
            }
107
            catch (Exception e) {
106
            catch (Exception e) {
108
                throw new JspTagException(
107
                throw new JspTagException(
109
                    Resources.getMessage("DRIVER_INVALID_CLASS",
108
                        Resources.getMessage("DRIVER_INVALID_CLASS",
110
					 e.toString()), e);
109
                                e.toString()), e);
111
            }
110
            }
112
            dsw.setJdbcURL(jdbcURL);
111
            dsw.setJdbcURL(jdbcURL);
113
            dsw.setUserName(userName);
112
            dsw.setUserName(userName);
114
            dsw.setPassword(password);
113
            dsw.setPassword(password);
115
	    ds = (DataSource) dsw;
114
            ds = (DataSource) dsw;
116
        }
115
        }
117
116
118
        if (var != null) {
117
        if (var != null) {
119
	    pageContext.setAttribute(var, ds, scope);
118
            pageContext.setAttribute(var, ds, scope);
120
        } else {
119
        } else {
121
            Config.set(pageContext, Config.SQL_DATA_SOURCE, ds, scope);
120
            Config.set(pageContext, Config.SQL_DATA_SOURCE, ds, scope);
122
        }
121
        }
123
122
124
	return SKIP_BODY;
123
        return SKIP_BODY;
125
    }
124
    }
126
125
127
    // Releases any resources we may have (or inherit)
126
    // Releases any resources we may have (or inherit)
127
128
    @Override
128
    @Override
129
    public void release() {
129
    public void release() {
130
	init();
130
        init();
131
    }
131
    }
132
}
132
}
(-)src/main/java/org/apache/taglibs/standard/tag/common/sql/ResultImpl.java (-22 / +21 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tag.common.sql;
18
package org.apache.taglibs.standard.tag.common.sql;
19
19
Lines 29-38 Link Here
29
29
30
/**
30
/**
31
 * <p>This class creates a cached version of a <tt>ResultSet</tt>.
31
 * <p>This class creates a cached version of a <tt>ResultSet</tt>.
32
 * It's represented as a <tt>Result</tt> implementation, capable of 
32
 * It's represented as a <tt>Result</tt> implementation, capable of
33
 * returing an array of <tt>Row</tt> objects containing a <tt>Column</tt> 
33
 * returing an array of <tt>Row</tt> objects containing a <tt>Column</tt>
34
 * instance for each column in the row.</p>
34
 * instance for each column in the row.</p>
35
 *
35
 * <p/>
36
 * <p>Note -- this is a private copy for the RI to avoid making the
36
 * <p>Note -- this is a private copy for the RI to avoid making the
37
 * corresponding class in javax.servlet.* public.</p>
37
 * corresponding class in javax.servlet.* public.</p>
38
 *
38
 *
Lines 50-56 Link Here
50
     * Build a <code>Result</code> object from a <code>ResultSet</code> object.
50
     * Build a <code>Result</code> object from a <code>ResultSet</code> object.
51
     *
51
     *
52
     * @param rs an open <tt>ResultSet</tt>, positioned before the first row
52
     * @param rs an open <tt>ResultSet</tt>, positioned before the first row
53
     * @exception SQLException if a database error occurs
53
     * @throws SQLException if a database error occurs
54
     */
54
     */
55
    public ResultImpl(ResultSet rs) throws SQLException {
55
    public ResultImpl(ResultSet rs) throws SQLException {
56
        this(rs, -1, -1);
56
        this(rs, -1, -1);
Lines 59-67 Link Here
59
    /**
59
    /**
60
     * Build a <code>Result</code> object from a <code>ResultSet</code> object.
60
     * Build a <code>Result</code> object from a <code>ResultSet</code> object.
61
     *
61
     *
62
     * @param rs an open <tt>ResultSet</tt>, positioned before the first row
62
     * @param rs      an open <tt>ResultSet</tt>, positioned before the first row
63
     * @param maxRows query maximum rows limit
63
     * @param maxRows query maximum rows limit
64
     * @exception SQLException if a database error occurs
64
     * @throws SQLException if a database error occurs
65
     */
65
     */
66
    public ResultImpl(ResultSet rs, int maxRows) throws SQLException {
66
    public ResultImpl(ResultSet rs, int maxRows) throws SQLException {
67
        // Matching API in ResultSupport - apologies for the bad 
67
        // Matching API in ResultSupport - apologies for the bad 
Lines 73-87 Link Here
73
     * This constructor reads the ResultSet and saves a cached
73
     * This constructor reads the ResultSet and saves a cached
74
     * copy.
74
     * copy.
75
     *
75
     *
76
     * @param rs an open <tt>ResultSet</tt>, positioned before the first
76
     * @param rs       an open <tt>ResultSet</tt>, positioned before the first
77
     * row
77
     *                 row
78
     * @param startRow beginning row to be cached
78
     * @param startRow beginning row to be cached
79
     * @param maxRows  query maximum rows limit
79
     * @param maxRows  query maximum rows limit
80
     * @exception SQLException if a database error occurs
80
     * @throws SQLException if a database error occurs
81
     */
81
     */
82
    public ResultImpl(ResultSet rs, int startRow, int maxRows)
82
    public ResultImpl(ResultSet rs, int startRow, int maxRows)
83
        throws SQLException 
83
            throws SQLException {
84
    {
85
        rowMap = new ArrayList();
84
        rowMap = new ArrayList();
86
        rowByIndex = new ArrayList();
85
        rowByIndex = new ArrayList();
87
86
Lines 91-97 Link Here
91
        // Create the column name array
90
        // Create the column name array
92
        columnNames = new String[noOfColumns];
91
        columnNames = new String[noOfColumns];
93
        for (int i = 1; i <= noOfColumns; i++) {
92
        for (int i = 1; i <= noOfColumns; i++) {
94
            columnNames[i-1] = rsmd.getColumnName(i);
93
            columnNames[i - 1] = rsmd.getColumnName(i);
95
        }
94
        }
96
95
97
        // Throw away all rows upto startRow
96
        // Throw away all rows upto startRow
Lines 103-123 Link Here
103
        int processedRows = 0;
102
        int processedRows = 0;
104
        while (rs.next()) {
103
        while (rs.next()) {
105
            if ((maxRows != -1) && (processedRows == maxRows)) {
104
            if ((maxRows != -1) && (processedRows == maxRows)) {
106
                isLimited = true; 
105
                isLimited = true;
107
                break;
106
                break;
108
            }
107
            }
109
            Object[] columns = new Object[noOfColumns];
108
            Object[] columns = new Object[noOfColumns];
110
            SortedMap columnMap = 
109
            SortedMap columnMap =
111
                new TreeMap(String.CASE_INSENSITIVE_ORDER);
110
                    new TreeMap(String.CASE_INSENSITIVE_ORDER);
112
111
113
            // JDBC uses 1 as the lowest index!
112
            // JDBC uses 1 as the lowest index!
114
            for (int i = 1; i <= noOfColumns; i++) {
113
            for (int i = 1; i <= noOfColumns; i++) {
115
                Object value =  rs.getObject(i);
114
                Object value = rs.getObject(i);
116
                if (rs.wasNull()) {
115
                if (rs.wasNull()) {
117
                    value = null;
116
                    value = null;
118
                }
117
                }
119
                columns[i-1] = value;
118
                columns[i - 1] = value;
120
                columnMap.put(columnNames[i-1], value);
119
                columnMap.put(columnNames[i - 1], value);
121
            }
120
            }
122
            rowMap.add(columnMap);
121
            rowMap.add(columnMap);
123
            rowByIndex.add(columns);
122
            rowByIndex.add(columns);
Lines 140-146 Link Here
140
        }
139
        }
141
140
142
        //should just be able to return SortedMap[] object
141
        //should just be able to return SortedMap[] object
143
        return (SortedMap []) rowMap.toArray(new SortedMap[0]);
142
        return (SortedMap[]) rowMap.toArray(new SortedMap[0]);
144
    }
143
    }
145
144
146
145
Lines 157-163 Link Here
157
        }
156
        }
158
157
159
        //should just be able to return Object[][] object
158
        //should just be able to return Object[][] object
160
        return (Object [][])rowByIndex.toArray(new Object[0][0]);
159
        return (Object[][]) rowByIndex.toArray(new Object[0][0]);
161
    }
160
    }
162
161
163
    /**
162
    /**
Lines 175-181 Link Here
175
     * Returns the number of rows in the cached ResultSet
174
     * Returns the number of rows in the cached ResultSet
176
     *
175
     *
177
     * @return the number of cached rows, or -1 if the Result could
176
     * @return the number of cached rows, or -1 if the Result could
178
     *    not be initialized due to SQLExceptions
177
     *         not be initialized due to SQLExceptions
179
     */
178
     */
180
    public int getRowCount() {
179
    public int getRowCount() {
181
        if (rowMap == null) {
180
        if (rowMap == null) {
(-)src/main/java/org/apache/taglibs/standard/tag/common/sql/DateParamTagSupport.java (-28 / +28 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
package org.apache.taglibs.standard.tag.common.sql;
17
package org.apache.taglibs.standard.tag.common.sql;
18
18
19
import javax.servlet.jsp.JspException;
19
import javax.servlet.jsp.JspException;
Lines 27-33 Link Here
27
/**
27
/**
28
 * <p>Tag handler for &lt;Param&gt; in JSTL, used to set
28
 * <p>Tag handler for &lt;Param&gt; in JSTL, used to set
29
 * parameter values for a SQL statement.</p>
29
 * parameter values for a SQL statement.</p>
30
 * 
30
 *
31
 * @author Justyna Horwat
31
 * @author Justyna Horwat
32
 */
32
 */
33
33
Lines 35-46 Link Here
35
35
36
    //*********************************************************************
36
    //*********************************************************************
37
    // Private constants
37
    // Private constants
38
    
38
39
    private static final String TIMESTAMP_TYPE = "timestamp";
39
    private static final String TIMESTAMP_TYPE = "timestamp";
40
    private static final String TIME_TYPE = "time";
40
    private static final String TIME_TYPE = "time";
41
    private static final String DATE_TYPE = "date";
41
    private static final String DATE_TYPE = "date";
42
	
43
42
43
44
    //*********************************************************************
44
    //*********************************************************************
45
    // Protected state
45
    // Protected state
46
46
Lines 67-85 Link Here
67
67
68
    @Override
68
    @Override
69
    public int doEndTag() throws JspException {
69
    public int doEndTag() throws JspException {
70
	SQLExecutionTag parent = (SQLExecutionTag) 
70
        SQLExecutionTag parent = (SQLExecutionTag)
71
	    findAncestorWithClass(this, SQLExecutionTag.class);
71
                findAncestorWithClass(this, SQLExecutionTag.class);
72
	if (parent == null) {
72
        if (parent == null) {
73
	    throw new JspTagException(
73
            throw new JspTagException(
74
                Resources.getMessage("SQL_PARAM_OUTSIDE_PARENT"));
74
                    Resources.getMessage("SQL_PARAM_OUTSIDE_PARENT"));
75
	}
75
        }
76
76
77
        if (value != null) {
77
        if (value != null) {
78
            convertValue();
78
            convertValue();
79
        }
79
        }
80
80
81
	parent.addSQLParameter(value);
81
        parent.addSQLParameter(value);
82
	return EVAL_PAGE;
82
        return EVAL_PAGE;
83
    }
83
    }
84
84
85
85
Lines 88-108 Link Here
88
88
89
    private void convertValue() throws JspException {
89
    private void convertValue() throws JspException {
90
90
91
	if ((type == null) || (type.equalsIgnoreCase(TIMESTAMP_TYPE))) {
91
        if ((type == null) || (type.equalsIgnoreCase(TIMESTAMP_TYPE))) {
92
	    if (!(value instanceof java.sql.Timestamp)) {
92
            if (!(value instanceof java.sql.Timestamp)) {
93
		value = new java.sql.Timestamp(value.getTime());
93
                value = new java.sql.Timestamp(value.getTime());
94
	    }
94
            }
95
	} else if (type.equalsIgnoreCase(TIME_TYPE)) {
95
        } else if (type.equalsIgnoreCase(TIME_TYPE)) {
96
	    if (!(value instanceof java.sql.Time)) {
96
            if (!(value instanceof java.sql.Time)) {
97
		value = new java.sql.Time(value.getTime());
97
                value = new java.sql.Time(value.getTime());
98
	    }
98
            }
99
	} else if (type.equalsIgnoreCase(DATE_TYPE)) {
99
        } else if (type.equalsIgnoreCase(DATE_TYPE)) {
100
	    if (!(value instanceof java.sql.Date)) {
100
            if (!(value instanceof java.sql.Date)) {
101
		value = new java.sql.Date(value.getTime());
101
                value = new java.sql.Date(value.getTime());
102
	    }
102
            }
103
	} else {
103
        } else {
104
	    throw new JspException(
104
            throw new JspException(
105
                Resources.getMessage("SQL_DATE_PARAM_INVALID_TYPE", type));
105
                    Resources.getMessage("SQL_DATE_PARAM_INVALID_TYPE", type));
106
	}
106
        }
107
    }
107
    }
108
}
108
}
(-)src/main/java/org/apache/taglibs/standard/tag/common/sql/DataSourceUtil.java (-33 / +30 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tag.common.sql;
18
package org.apache.taglibs.standard.tag.common.sql;
19
19
Lines 32-40 Link Here
32
/**
32
/**
33
 * <p>A simple <code>DataSource</code> utility for the standard
33
 * <p>A simple <code>DataSource</code> utility for the standard
34
 * <code>DriverManager</code> class.
34
 * <code>DriverManager</code> class.
35
 *
35
 * <p/>
36
 * TO DO: need to cache DataSource
36
 * TO DO: need to cache DataSource
37
 * 
37
 *
38
 * @author Justyna Horwat
38
 * @author Justyna Horwat
39
 */
39
 */
40
public class DataSourceUtil {
40
public class DataSourceUtil {
Lines 49-71 Link Here
49
     * is
49
     * is
50
     */
50
     */
51
    static DataSource getDataSource(Object rawDataSource, PageContext pc)
51
    static DataSource getDataSource(Object rawDataSource, PageContext pc)
52
	throws JspException
52
            throws JspException {
53
    {
53
        DataSource dataSource = null;
54
	DataSource dataSource = null;
55
54
56
        if (rawDataSource == null) {
55
        if (rawDataSource == null) {
57
            rawDataSource = Config.find(pc, Config.SQL_DATA_SOURCE);
56
            rawDataSource = Config.find(pc, Config.SQL_DATA_SOURCE);
58
        }
57
        }
59
58
60
	if (rawDataSource == null) {
59
        if (rawDataSource == null) {
61
	    return null;
60
            return null;
62
	}
61
        }
63
62
64
        /*
63
        /*
65
	 * If the 'dataSource' attribute's value resolves to a String
64
         * If the 'dataSource' attribute's value resolves to a String
66
	 * after rtexpr/EL evaluation, use the string as JNDI path to
65
         * after rtexpr/EL evaluation, use the string as JNDI path to
67
	 * a DataSource
66
         * a DataSource
68
	 */
67
         */
69
        if (rawDataSource instanceof String) {
68
        if (rawDataSource instanceof String) {
70
            try {
69
            try {
71
                Context ctx = new InitialContext();
70
                Context ctx = new InitialContext();
Lines 78-143 Link Here
78
        } else if (rawDataSource instanceof DataSource) {
77
        } else if (rawDataSource instanceof DataSource) {
79
            dataSource = (DataSource) rawDataSource;
78
            dataSource = (DataSource) rawDataSource;
80
        } else {
79
        } else {
81
	    throw new JspException(
80
            throw new JspException(
82
                Resources.getMessage("SQL_DATASOURCE_INVALID_TYPE"));
81
                    Resources.getMessage("SQL_DATASOURCE_INVALID_TYPE"));
83
	}
82
        }
84
83
85
	return dataSource;
84
        return dataSource;
86
    }
85
    }
87
86
88
    /**
87
    /**
89
     * Parse JDBC parameters and setup dataSource appropriately
88
     * Parse JDBC parameters and setup dataSource appropriately
90
     */
89
     */
91
    private static DataSource getDataSource(String params)
90
    private static DataSource getDataSource(String params)
92
	throws JspException
91
            throws JspException {
93
    {
94
        DataSourceWrapper dataSource = new DataSourceWrapper();
92
        DataSourceWrapper dataSource = new DataSourceWrapper();
95
93
96
        String[] paramString = new String[4];
94
        String[] paramString = new String[4];
97
        int escCount = 0; 
95
        int escCount = 0;
98
        int aryCount = 0; 
96
        int aryCount = 0;
99
        int begin = 0;
97
        int begin = 0;
100
98
101
        for(int index=0; index < params.length(); index++) {
99
        for (int index = 0; index < params.length(); index++) {
102
            char nextChar = params.charAt(index);
100
            char nextChar = params.charAt(index);
103
            if (TOKEN.indexOf(nextChar) != -1) {
101
            if (TOKEN.indexOf(nextChar) != -1) {
104
                if (escCount == 0) {
102
                if (escCount == 0) {
105
                    paramString[aryCount] = params.substring(begin,index).trim();
103
                    paramString[aryCount] = params.substring(begin, index).trim();
106
                    begin = index + 1;
104
                    begin = index + 1;
107
                    if (++aryCount > 4) {
105
                    if (++aryCount > 4) {
108
                        throw new JspTagException(
106
                        throw new JspTagException(
109
                            Resources.getMessage("JDBC_PARAM_COUNT"));
107
                                Resources.getMessage("JDBC_PARAM_COUNT"));
110
                    }
108
                    }
111
                }
109
                }
112
            }
110
            }
113
            if (ESCAPE.indexOf(nextChar) != -1) {
111
            if (ESCAPE.indexOf(nextChar) != -1) {
114
                escCount++;
112
                escCount++;
115
            }
113
            } else {
116
            else {
117
                escCount = 0;
114
                escCount = 0;
118
            }
115
            }
119
        }
116
        }
120
        paramString[aryCount] = params.substring(begin).trim();
117
        paramString[aryCount] = params.substring(begin).trim();
121
118
122
	// use the JDBC URL from the parameter string
119
        // use the JDBC URL from the parameter string
123
        dataSource.setJdbcURL(paramString[0]);
120
        dataSource.setJdbcURL(paramString[0]);
124
121
125
	// try to load a driver if it's present
122
        // try to load a driver if it's present
126
        if (paramString[1] != null) {
123
        if (paramString[1] != null) {
127
            try {
124
            try {
128
                dataSource.setDriverClassName(paramString[1]);
125
                dataSource.setDriverClassName(paramString[1]);
129
            } catch (Exception ex) {
126
            } catch (Exception ex) {
130
                throw new JspTagException(
127
                throw new JspTagException(
131
                    Resources.getMessage("DRIVER_INVALID_CLASS",
128
                        Resources.getMessage("DRIVER_INVALID_CLASS",
132
					 ex.toString()), ex);
129
                                ex.toString()), ex);
133
            }
130
            }
134
	}
131
        }
135
132
136
	// set the username and password
133
        // set the username and password
137
        dataSource.setUserName(paramString[2]);
134
        dataSource.setUserName(paramString[2]);
138
        dataSource.setPassword(paramString[3]);
135
        dataSource.setPassword(paramString[3]);
139
136
140
	return dataSource;
137
        return dataSource;
141
    }
138
    }
142
139
143
}
140
}
(-)src/main/java/org/apache/taglibs/standard/tag/common/sql/ParamTagSupport.java (-20 / +19 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
package org.apache.taglibs.standard.tag.common.sql;
17
package org.apache.taglibs.standard.tag.common.sql;
18
18
19
import javax.servlet.jsp.JspException;
19
import javax.servlet.jsp.JspException;
Lines 27-33 Link Here
27
/**
27
/**
28
 * <p>Tag handler for &lt;Param&gt; in JSTL, used to set
28
 * <p>Tag handler for &lt;Param&gt; in JSTL, used to set
29
 * parameter values for a SQL statement.</p>
29
 * parameter values for a SQL statement.</p>
30
 * 
30
 *
31
 * @author Hans Bergsten
31
 * @author Hans Bergsten
32
 */
32
 */
33
33
Lines 39-63 Link Here
39
39
40
    @Override
40
    @Override
41
    public int doEndTag() throws JspException {
41
    public int doEndTag() throws JspException {
42
	SQLExecutionTag parent = (SQLExecutionTag) 
42
        SQLExecutionTag parent = (SQLExecutionTag)
43
	    findAncestorWithClass(this, SQLExecutionTag.class);
43
                findAncestorWithClass(this, SQLExecutionTag.class);
44
	if (parent == null) {
44
        if (parent == null) {
45
	    throw new JspTagException(
45
            throw new JspTagException(
46
                Resources.getMessage("SQL_PARAM_OUTSIDE_PARENT"));
46
                    Resources.getMessage("SQL_PARAM_OUTSIDE_PARENT"));
47
	}
47
        }
48
48
49
	Object paramValue = null;
49
        Object paramValue = null;
50
	if (value != null) {
50
        if (value != null) {
51
	    paramValue = value;
51
            paramValue = value;
52
	}
52
        } else if (bodyContent != null) {
53
	else if (bodyContent != null) {
53
            paramValue = bodyContent.getString().trim();
54
	    paramValue = bodyContent.getString().trim();
54
            if (((String) paramValue).trim().length() == 0) {
55
	    if (((String) paramValue).trim().length() == 0) {
55
                paramValue = null;
56
		paramValue = null;
56
            }
57
	    }
57
        }
58
	}
59
58
60
	parent.addSQLParameter(paramValue);
59
        parent.addSQLParameter(paramValue);
61
	return EVAL_PAGE;
60
        return EVAL_PAGE;
62
    }
61
    }
63
}
62
}
(-)src/main/java/org/apache/taglibs/standard/tag/common/sql/DataSourceWrapper.java (-17 / +20 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tag.common.sql;
18
package org.apache.taglibs.standard.tag.common.sql;
19
19
Lines 32-38 Link Here
32
/**
32
/**
33
 * <p>A simple <code>DataSource</code> wrapper for the standard
33
 * <p>A simple <code>DataSource</code> wrapper for the standard
34
 * <code>DriverManager</code> class.
34
 * <code>DriverManager</code> class.
35
 * 
35
 *
36
 * @author Hans Bergsten
36
 * @author Hans Bergsten
37
 */
37
 */
38
public class DataSourceWrapper implements DataSource {
38
public class DataSourceWrapper implements DataSource {
Lines 41-48 Link Here
41
    private String userName;
41
    private String userName;
42
    private String password;
42
    private String password;
43
43
44
    public void setDriverClassName(String driverClassName) 
44
    public void setDriverClassName(String driverClassName)
45
        throws ClassNotFoundException, InstantiationException, 
45
            throws ClassNotFoundException, InstantiationException,
46
            IllegalAccessException {
46
            IllegalAccessException {
47
47
48
        //get the classloader
48
        //get the classloader
Lines 52-62 Link Here
52
            cl = Thread.currentThread().getContextClassLoader();
52
            cl = Thread.currentThread().getContextClassLoader();
53
        } else {
53
        } else {
54
            cl = java.security.AccessController.doPrivileged(
54
            cl = java.security.AccessController.doPrivileged(
55
                    new java.security.PrivilegedAction<ClassLoader>() 
55
                    new java.security.PrivilegedAction<ClassLoader>() {
56
                    {public ClassLoader run() {return Thread.currentThread().getContextClassLoader();}});
56
                        public ClassLoader run() {
57
                            return Thread.currentThread().getContextClassLoader();
58
                        }
59
                    });
57
        }
60
        }
58
        //done getting classloader
61
        //done getting classloader
59
    
62
60
        Object instance = Class.forName(driverClassName, true, cl).newInstance();
63
        Object instance = Class.forName(driverClassName, true, cl).newInstance();
61
        if (instance instanceof Driver) {
64
        if (instance instanceof Driver) {
62
            driver = (Driver) instance;
65
            driver = (Driver) instance;
Lines 64-78 Link Here
64
    }
67
    }
65
68
66
    public void setJdbcURL(String jdbcURL) {
69
    public void setJdbcURL(String jdbcURL) {
67
	this.jdbcURL = jdbcURL;
70
        this.jdbcURL = jdbcURL;
68
    }
71
    }
69
72
70
    public void setUserName(String userName) {
73
    public void setUserName(String userName) {
71
	this.userName = userName;
74
        this.userName = userName;
72
    }
75
    }
73
76
74
    public void setPassword(String password) {
77
    public void setPassword(String password) {
75
	this.password = password;
78
        this.password = password;
76
    }
79
    }
77
80
78
    /**
81
    /**
Lines 100-143 Link Here
100
        }
103
        }
101
        return conn;
104
        return conn;
102
    }
105
    }
103
    
106
104
    /**
107
    /**
105
     * Always throws a SQLException. Username and password are set
108
     * Always throws a SQLException. Username and password are set
106
     * in the constructor and can not be changed.
109
     * in the constructor and can not be changed.
107
     */
110
     */
108
    public Connection getConnection(String username, String password) 
111
    public Connection getConnection(String username, String password)
109
            throws SQLException {
112
            throws SQLException {
110
        throw new SQLException(Resources.getMessage("NOT_SUPPORTED"));
113
        throw new SQLException(Resources.getMessage("NOT_SUPPORTED"));
111
    }
114
    }
112
    
115
113
    /**
116
    /**
114
     * Always throws a SQLException. Not supported.
117
     * Always throws a SQLException. Not supported.
115
     */
118
     */
116
    public int getLoginTimeout() throws SQLException {
119
    public int getLoginTimeout() throws SQLException {
117
        throw new SQLException(Resources.getMessage("NOT_SUPPORTED"));
120
        throw new SQLException(Resources.getMessage("NOT_SUPPORTED"));
118
    }
121
    }
119
    
122
120
    /**
123
    /**
121
     * Always throws a SQLException. Not supported.
124
     * Always throws a SQLException. Not supported.
122
     */
125
     */
123
    public PrintWriter getLogWriter() throws SQLException {
126
    public PrintWriter getLogWriter() throws SQLException {
124
        throw new SQLException(Resources.getMessage("NOT_SUPPORTED"));
127
        throw new SQLException(Resources.getMessage("NOT_SUPPORTED"));
125
    }
128
    }
126
    
129
127
    /**
130
    /**
128
     * Always throws a SQLException. Not supported.
131
     * Always throws a SQLException. Not supported.
129
     */
132
     */
130
    public void setLoginTimeout(int seconds) throws SQLException {
133
    public void setLoginTimeout(int seconds) throws SQLException {
131
        throw new SQLException(Resources.getMessage("NOT_SUPPORTED"));
134
        throw new SQLException(Resources.getMessage("NOT_SUPPORTED"));
132
    }
135
    }
133
    
136
134
    /**
137
    /**
135
     * Always throws a SQLException. Not supported.
138
     * Always throws a SQLException. Not supported.
136
     */
139
     */
137
    public synchronized void setLogWriter(PrintWriter out) throws SQLException {
140
    public synchronized void setLogWriter(PrintWriter out) throws SQLException {
138
        throw new SQLException(Resources.getMessage("NOT_SUPPORTED"));
141
        throw new SQLException(Resources.getMessage("NOT_SUPPORTED"));
139
    }
142
    }
140
    
143
141
    public synchronized boolean isWrapperFor(Class c) throws SQLException {
144
    public synchronized boolean isWrapperFor(Class c) throws SQLException {
142
        throw new SQLException(Resources.getMessage("NOT_SUPPORTED"));
145
        throw new SQLException(Resources.getMessage("NOT_SUPPORTED"));
143
    }
146
    }
(-)src/main/java/org/apache/taglibs/standard/tag/common/sql/UpdateTagSupport.java (-97 / +96 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tag.common.sql;
18
package org.apache.taglibs.standard.tag.common.sql;
19
19
Lines 35-48 Link Here
35
import org.apache.taglibs.standard.tag.common.core.Util;
35
import org.apache.taglibs.standard.tag.common.core.Util;
36
36
37
/**
37
/**
38
 * <p>Tag handler for &lt;Update&gt; in JSTL.  
38
 * <p>Tag handler for &lt;Update&gt; in JSTL.
39
 * 
39
 *
40
 * @author Hans Bergsten
40
 * @author Hans Bergsten
41
 * @author Justyna Horwat
41
 * @author Justyna Horwat
42
 */
42
 */
43
43
44
public abstract class UpdateTagSupport extends BodyTagSupport 
44
public abstract class UpdateTagSupport extends BodyTagSupport
45
    implements TryCatchFinally, SQLExecutionTag {
45
        implements TryCatchFinally, SQLExecutionTag {
46
46
47
    private String var;
47
    private String var;
48
    private int scope;
48
    private int scope;
Lines 68-85 Link Here
68
    // Constructor and initialization
68
    // Constructor and initialization
69
69
70
    public UpdateTagSupport() {
70
    public UpdateTagSupport() {
71
	super();
71
        super();
72
	init();
72
        init();
73
    }
73
    }
74
74
75
    private void init() {
75
    private void init() {
76
	rawDataSource = null;
76
        rawDataSource = null;
77
	sql = null;
77
        sql = null;
78
	conn = null;
78
        conn = null;
79
	parameters = null;
79
        parameters = null;
80
	isPartOfTransaction = dataSourceSpecified = false;
80
        isPartOfTransaction = dataSourceSpecified = false;
81
        scope = PageContext.PAGE_SCOPE;
81
        scope = PageContext.PAGE_SCOPE;
82
	var = null;
82
        var = null;
83
    }
83
    }
84
84
85
85
Lines 91-97 Link Here
91
     * result.
91
     * result.
92
     */
92
     */
93
    public void setVar(String var) {
93
    public void setVar(String var) {
94
	this.var = var;
94
        this.var = var;
95
    }
95
    }
96
96
97
    /**
97
    /**
Lines 113-125 Link Here
113
    @Override
113
    @Override
114
    public int doStartTag() throws JspException {
114
    public int doStartTag() throws JspException {
115
115
116
	try {
116
        try {
117
	    conn = getConnection();
117
            conn = getConnection();
118
	} catch (SQLException e) {
118
        } catch (SQLException e) {
119
	    throw new JspException(sql + ": " + e.getMessage(), e);
119
            throw new JspException(sql + ": " + e.getMessage(), e);
120
	}
120
        }
121
121
122
	return EVAL_BODY_BUFFERED;
122
        return EVAL_BODY_BUFFERED;
123
    }
123
    }
124
124
125
    /**
125
    /**
Lines 128-134 Link Here
128
     * named by the <code>var</code> attribute in the scope specified
128
     * named by the <code>var</code> attribute in the scope specified
129
     * by the <code>scope</code> attribute, as an object that implements
129
     * by the <code>scope</code> attribute, as an object that implements
130
     * the Result interface.
130
     * the Result interface.
131
     *
131
     * <p/>
132
     * <p>The connection used to execute the statement comes either
132
     * <p>The connection used to execute the statement comes either
133
     * from the <code>DataSource</code> specified by the
133
     * from the <code>DataSource</code> specified by the
134
     * <code>dataSource</code> attribute, provided by a parent action
134
     * <code>dataSource</code> attribute, provided by a parent action
Lines 137-186 Link Here
137
     */
137
     */
138
    @Override
138
    @Override
139
    public int doEndTag() throws JspException {
139
    public int doEndTag() throws JspException {
140
	/*
140
        /*
141
	 * Use the SQL statement specified by the sql attribute, if any,
141
       * Use the SQL statement specified by the sql attribute, if any,
142
	 * otherwise use the body as the statement.
142
       * otherwise use the body as the statement.
143
	 */
143
       */
144
	String sqlStatement = null;
144
        String sqlStatement = null;
145
	if (sql != null) {
145
        if (sql != null) {
146
	    sqlStatement = sql;
146
            sqlStatement = sql;
147
	}
147
        } else if (bodyContent != null) {
148
	else if (bodyContent != null) {
148
            sqlStatement = bodyContent.getString();
149
	    sqlStatement = bodyContent.getString();
149
        }
150
	}
150
        if (sqlStatement == null || sqlStatement.trim().length() == 0) {
151
	if (sqlStatement == null || sqlStatement.trim().length() == 0) {
151
            throw new JspTagException(
152
	    throw new JspTagException(
152
                    Resources.getMessage("SQL_NO_STATEMENT"));
153
                Resources.getMessage("SQL_NO_STATEMENT"));
153
        }
154
	}
155
154
156
	int result = 0;
155
        int result = 0;
157
	PreparedStatement ps = null;
156
        PreparedStatement ps = null;
158
	try {
157
        try {
159
	    ps = conn.prepareStatement(sqlStatement);
158
            ps = conn.prepareStatement(sqlStatement);
160
	    setParameters(ps, parameters);
159
            setParameters(ps, parameters);
161
	    result = ps.executeUpdate();
160
            result = ps.executeUpdate();
162
	}
161
        }
163
	catch (Throwable e) {
162
        catch (Throwable e) {
164
	    throw new JspException(sqlStatement + ": " + e.getMessage(), e);
163
            throw new JspException(sqlStatement + ": " + e.getMessage(), e);
165
	} finally {
164
        } finally {
166
	    if (ps != null) {
165
            if (ps != null) {
167
		try {
166
                try {
168
		    ps.close();
167
                    ps.close();
169
		} catch (SQLException sqe) {
168
                } catch (SQLException sqe) {
170
		    throw new JspException(sqe.getMessage(), sqe);
169
                    throw new JspException(sqe.getMessage(), sqe);
171
		}
170
                }
172
	    }
171
            }
173
	}
172
        }
174
	if (var != null)
173
        if (var != null) {
175
	    pageContext.setAttribute(var, new Integer(result), scope);
174
            pageContext.setAttribute(var, new Integer(result), scope);
176
	return EVAL_PAGE;
175
        }
176
        return EVAL_PAGE;
177
    }
177
    }
178
178
179
    /**
179
    /**
180
     * Just rethrows the Throwable.
180
     * Just rethrows the Throwable.
181
     */
181
     */
182
    public void doCatch(Throwable t) throws Throwable {
182
    public void doCatch(Throwable t) throws Throwable {
183
	throw t;
183
        throw t;
184
    }
184
    }
185
185
186
    /**
186
    /**
Lines 188-203 Link Here
188
     * as part of a transaction.
188
     * as part of a transaction.
189
     */
189
     */
190
    public void doFinally() {
190
    public void doFinally() {
191
	if (conn != null && !isPartOfTransaction) {
191
        if (conn != null && !isPartOfTransaction) {
192
	    try {
192
            try {
193
		conn.close();
193
                conn.close();
194
	    } catch (SQLException e) {
194
            } catch (SQLException e) {
195
		// Not much we can do
195
                // Not much we can do
196
	    }
196
            }
197
	}
197
        }
198
198
199
	parameters = null;
199
        parameters = null;
200
	conn = null;
200
        conn = null;
201
    }
201
    }
202
202
203
203
Lines 209-218 Link Here
209
     * parameter values.
209
     * parameter values.
210
     */
210
     */
211
    public void addSQLParameter(Object o) {
211
    public void addSQLParameter(Object o) {
212
	if (parameters == null) {
212
        if (parameters == null) {
213
	    parameters = new ArrayList();
213
            parameters = new ArrayList();
214
	}
214
        }
215
	parameters.add(o);
215
        parameters.add(o);
216
    }
216
    }
217
217
218
218
Lines 220-269 Link Here
220
    // Private utility methods
220
    // Private utility methods
221
221
222
    private Connection getConnection() throws JspException, SQLException {
222
    private Connection getConnection() throws JspException, SQLException {
223
	// Fix: Add all other mechanisms
223
        // Fix: Add all other mechanisms
224
	Connection conn = null;
224
        Connection conn = null;
225
	isPartOfTransaction = false;
225
        isPartOfTransaction = false;
226
226
227
	TransactionTagSupport parent = (TransactionTagSupport) 
227
        TransactionTagSupport parent = (TransactionTagSupport)
228
	    findAncestorWithClass(this, TransactionTagSupport.class);
228
                findAncestorWithClass(this, TransactionTagSupport.class);
229
	if (parent != null) {
229
        if (parent != null) {
230
            if (dataSourceSpecified) {
230
            if (dataSourceSpecified) {
231
                throw new JspTagException(
231
                throw new JspTagException(
232
                    Resources.getMessage("ERROR_NESTED_DATASOURCE"));
232
                        Resources.getMessage("ERROR_NESTED_DATASOURCE"));
233
            }
233
            }
234
	    conn = parent.getSharedConnection();
234
            conn = parent.getSharedConnection();
235
            isPartOfTransaction = true;
235
            isPartOfTransaction = true;
236
	} else {
236
        } else {
237
	    if ((rawDataSource == null) && dataSourceSpecified) {
237
            if ((rawDataSource == null) && dataSourceSpecified) {
238
		throw new JspException(
238
                throw new JspException(
239
		    Resources.getMessage("SQL_DATASOURCE_NULL"));
239
                        Resources.getMessage("SQL_DATASOURCE_NULL"));
240
	    }
240
            }
241
	    DataSource dataSource = DataSourceUtil.getDataSource(rawDataSource,
241
            DataSource dataSource = DataSourceUtil.getDataSource(rawDataSource,
242
								 pageContext);
242
                    pageContext);
243
            try {
243
            try {
244
                conn = dataSource.getConnection();
244
                conn = dataSource.getConnection();
245
            } catch (Exception ex) {
245
            } catch (Exception ex) {
246
                throw new JspException(
246
                throw new JspException(
247
                    Resources.getMessage("DATASOURCE_INVALID",
247
                        Resources.getMessage("DATASOURCE_INVALID",
248
					 ex.toString()));
248
                                ex.toString()));
249
            }
249
            }
250
	}
250
        }
251
251
252
	return conn;
252
        return conn;
253
    }
253
    }
254
254
255
    private void setParameters(PreparedStatement ps, List parameters) 
255
    private void setParameters(PreparedStatement ps, List parameters)
256
        throws SQLException
256
            throws SQLException {
257
    {
257
        if (parameters != null) {
258
	if (parameters != null) {
258
            for (int i = 0; i < parameters.size(); i++) {
259
	    for (int i = 0; i < parameters.size(); i++) {
260
                /* The first parameter has index 1.  If a null
259
                /* The first parameter has index 1.  If a null
261
                 * is passed to setObject the parameter will be
260
                 * is passed to setObject the parameter will be
262
                 * set to JDBC null so an explicit call to
261
                 * set to JDBC null so an explicit call to
263
                 * ps.setNull is not required.
262
                 * ps.setNull is not required.
264
                 */
263
                 */
265
                ps.setObject(i + 1, parameters.get(i));
264
                ps.setObject(i + 1, parameters.get(i));
266
	    }
265
            }
267
	}
266
        }
268
    }
267
    }
269
}
268
}
(-)src/main/java/org/apache/taglibs/standard/tag/common/sql/QueryTagSupport.java (-24 / +17 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tag.common.sql;
18
package org.apache.taglibs.standard.tag.common.sql;
19
19
Lines 21-57 Link Here
21
import java.sql.PreparedStatement;
21
import java.sql.PreparedStatement;
22
import java.sql.ResultSet;
22
import java.sql.ResultSet;
23
import java.sql.SQLException;
23
import java.sql.SQLException;
24
25
import java.util.ArrayList;
24
import java.util.ArrayList;
26
import java.util.List;
25
import java.util.List;
27
26
28
import javax.servlet.jsp.JspException;
27
import javax.servlet.jsp.JspException;
29
import javax.servlet.jsp.JspTagException;
28
import javax.servlet.jsp.JspTagException;
30
import javax.servlet.jsp.PageContext;
29
import javax.servlet.jsp.PageContext;
31
32
import javax.servlet.jsp.jstl.core.Config;
30
import javax.servlet.jsp.jstl.core.Config;
33
34
import javax.servlet.jsp.jstl.sql.Result;
31
import javax.servlet.jsp.jstl.sql.Result;
35
import javax.servlet.jsp.jstl.sql.SQLExecutionTag;
32
import javax.servlet.jsp.jstl.sql.SQLExecutionTag;
36
37
import javax.servlet.jsp.tagext.BodyTagSupport;
33
import javax.servlet.jsp.tagext.BodyTagSupport;
38
import javax.servlet.jsp.tagext.TryCatchFinally;
34
import javax.servlet.jsp.tagext.TryCatchFinally;
39
40
import javax.sql.DataSource;
35
import javax.sql.DataSource;
41
36
42
import org.apache.taglibs.standard.resources.Resources;
37
import org.apache.taglibs.standard.resources.Resources;
43
44
import org.apache.taglibs.standard.tag.common.core.Util;
38
import org.apache.taglibs.standard.tag.common.core.Util;
45
39
46
/**
40
/**
47
 * <p>Tag handler for &lt;Query&gt; in JSTL.  
41
 * <p>Tag handler for &lt;Query&gt; in JSTL.
48
 * 
42
 *
49
 * @author Hans Bergsten
43
 * @author Hans Bergsten
50
 * @author Justyna Horwat
44
 * @author Justyna Horwat
51
 */
45
 */
52
46
53
public abstract class QueryTagSupport extends BodyTagSupport 
47
public abstract class QueryTagSupport extends BodyTagSupport
54
    implements TryCatchFinally, SQLExecutionTag {
48
        implements TryCatchFinally, SQLExecutionTag {
55
49
56
    private String var;
50
    private String var;
57
    private int scope;
51
    private int scope;
Lines 151-158 Link Here
151
                        maxRows = Integer.parseInt((String) obj);
145
                        maxRows = Integer.parseInt((String) obj);
152
                    } catch (NumberFormatException nfe) {
146
                    } catch (NumberFormatException nfe) {
153
                        throw new JspException(Resources.getMessage("SQL_MAXROWS_PARSE_ERROR",
147
                        throw new JspException(Resources.getMessage("SQL_MAXROWS_PARSE_ERROR",
154
                                                                    (String) obj),
148
                                (String) obj),
155
                                               nfe);
149
                                nfe);
156
                    }
150
                    }
157
                } else {
151
                } else {
158
                    throw new JspException(Resources.getMessage("SQL_MAXROWS_INVALID"));
152
                    throw new JspException(Resources.getMessage("SQL_MAXROWS_INVALID"));
Lines 175-181 Link Here
175
     * named by the <code>var</code> attribute in the scope specified
169
     * named by the <code>var</code> attribute in the scope specified
176
     * by the <code>scope</code> attribute, as an object that implements
170
     * by the <code>scope</code> attribute, as an object that implements
177
     * the Result interface.
171
     * the Result interface.
178
     *
172
     * <p/>
179
     * <p>The connection used to execute the statement comes either
173
     * <p>The connection used to execute the statement comes either
180
     * from the <code>DataSource</code> specified by the
174
     * from the <code>DataSource</code> specified by the
181
     * <code>dataSource</code> attribute, provided by a parent action
175
     * <code>dataSource</code> attribute, provided by a parent action
Lines 191-198 Link Here
191
        String sqlStatement = null;
185
        String sqlStatement = null;
192
        if (sql != null) {
186
        if (sql != null) {
193
            sqlStatement = sql;
187
            sqlStatement = sql;
194
        }
188
        } else if (bodyContent != null) {
195
        else if (bodyContent != null) {
196
            sqlStatement = bodyContent.getString();
189
            sqlStatement = bodyContent.getString();
197
        }
190
        }
198
        if (sqlStatement == null || sqlStatement.trim().length() == 0) {
191
        if (sqlStatement == null || sqlStatement.trim().length() == 0) {
Lines 277-283 Link Here
277
        if (conn != null && !isPartOfTransaction) {
270
        if (conn != null && !isPartOfTransaction) {
278
            try {
271
            try {
279
                conn.close();
272
                conn.close();
280
            } catch (SQLException e) {} // Not much we can do
273
            } catch (SQLException e) {
274
            } // Not much we can do
281
        }
275
        }
282
276
283
        conn = null;
277
        conn = null;
Lines 293-299 Link Here
293
        Connection conn = null;
287
        Connection conn = null;
294
        isPartOfTransaction = false;
288
        isPartOfTransaction = false;
295
289
296
        TransactionTagSupport parent = (TransactionTagSupport)findAncestorWithClass(this, TransactionTagSupport.class);
290
        TransactionTagSupport parent = (TransactionTagSupport) findAncestorWithClass(this, TransactionTagSupport.class);
297
        if (parent != null) {
291
        if (parent != null) {
298
            if (dataSourceSpecified) {
292
            if (dataSourceSpecified) {
299
                throw new JspTagException(Resources.getMessage("ERROR_NESTED_DATASOURCE"));
293
                throw new JspTagException(Resources.getMessage("ERROR_NESTED_DATASOURCE"));
Lines 305-325 Link Here
305
                throw new JspException(Resources.getMessage("SQL_DATASOURCE_NULL"));
299
                throw new JspException(Resources.getMessage("SQL_DATASOURCE_NULL"));
306
            }
300
            }
307
            DataSource dataSource = DataSourceUtil.getDataSource(rawDataSource,
301
            DataSource dataSource = DataSourceUtil.getDataSource(rawDataSource,
308
                                                                 pageContext);
302
                    pageContext);
309
            try {
303
            try {
310
                conn = dataSource.getConnection();
304
                conn = dataSource.getConnection();
311
            } catch (Exception ex) {
305
            } catch (Exception ex) {
312
                throw new JspException(Resources.getMessage("DATASOURCE_INVALID", 
306
                throw new JspException(Resources.getMessage("DATASOURCE_INVALID",
313
                                                            ex.toString()));
307
                        ex.toString()));
314
            }
308
            }
315
        }
309
        }
316
310
317
        return conn;
311
        return conn;
318
    }
312
    }
319
313
320
    private void setParameters(PreparedStatement ps, List parameters) 
314
    private void setParameters(PreparedStatement ps, List parameters)
321
        throws SQLException
315
            throws SQLException {
322
    {
323
        if (parameters != null) {
316
        if (parameters != null) {
324
            for (int i = 0; i < parameters.size(); i++) {
317
            for (int i = 0; i < parameters.size(); i++) {
325
                /* The first parameter has index 1.  If a null
318
                /* The first parameter has index 1.  If a null
(-)src/main/java/org/apache/taglibs/standard/tag/common/sql/TransactionTagSupport.java (-83 / +83 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tag.common.sql;
18
package org.apache.taglibs.standard.tag.common.sql;
19
19
Lines 30-54 Link Here
30
30
31
31
32
/**
32
/**
33
 * <p>Tag handler for &lt;Transaction&gt; in JSTL.  
33
 * <p>Tag handler for &lt;Transaction&gt; in JSTL.
34
 * 
34
 *
35
 * @author Hans Bergsten
35
 * @author Hans Bergsten
36
 */
36
 */
37
37
38
public abstract class TransactionTagSupport extends TagSupport 
38
public abstract class TransactionTagSupport extends TagSupport
39
    implements TryCatchFinally {
39
        implements TryCatchFinally {
40
40
41
    //*********************************************************************
41
    //*********************************************************************
42
    // Private constants
42
    // Private constants
43
43
44
    private static final String TRANSACTION_READ_COMMITTED
44
    private static final String TRANSACTION_READ_COMMITTED
45
	= "read_committed";
45
            = "read_committed";
46
    private static final String TRANSACTION_READ_UNCOMMITTED
46
    private static final String TRANSACTION_READ_UNCOMMITTED
47
	= "read_uncommitted";
47
            = "read_uncommitted";
48
    private static final String TRANSACTION_REPEATABLE_READ
48
    private static final String TRANSACTION_REPEATABLE_READ
49
	= "repeatable_read";
49
            = "repeatable_read";
50
    private static final String TRANSACTION_SERIALIZABLE
50
    private static final String TRANSACTION_SERIALIZABLE
51
	= "serializable";
51
            = "serializable";
52
52
53
53
54
    //*********************************************************************
54
    //*********************************************************************
Lines 70-84 Link Here
70
    // Constructor and initialization
70
    // Constructor and initialization
71
71
72
    public TransactionTagSupport() {
72
    public TransactionTagSupport() {
73
	super();
73
        super();
74
	conn = null;
74
        conn = null;
75
	dataSourceSpecified = false;
75
        dataSourceSpecified = false;
76
	rawDataSource = null;
76
        rawDataSource = null;
77
	isolation = Connection.TRANSACTION_NONE;
77
        isolation = Connection.TRANSACTION_NONE;
78
    }
78
    }
79
79
80
80
81
82
    //*********************************************************************
81
    //*********************************************************************
83
    // Tag logic
82
    // Tag logic
84
83
Lines 90-122 Link Here
90
    @Override
89
    @Override
91
    public int doStartTag() throws JspException {
90
    public int doStartTag() throws JspException {
92
91
93
	if ((rawDataSource == null) && dataSourceSpecified) {
92
        if ((rawDataSource == null) && dataSourceSpecified) {
94
	    throw new JspException(
93
            throw new JspException(
95
                Resources.getMessage("SQL_DATASOURCE_NULL"));
94
                    Resources.getMessage("SQL_DATASOURCE_NULL"));
96
	}
95
        }
97
96
98
        DataSource dataSource = DataSourceUtil.getDataSource(rawDataSource,
97
        DataSource dataSource = DataSourceUtil.getDataSource(rawDataSource,
99
							     pageContext);
98
                pageContext);
100
99
101
	try {
100
        try {
102
	    conn = dataSource.getConnection();
101
            conn = dataSource.getConnection();
103
	    origIsolation = conn.getTransactionIsolation();
102
            origIsolation = conn.getTransactionIsolation();
104
	    if (origIsolation == Connection.TRANSACTION_NONE) {
103
            if (origIsolation == Connection.TRANSACTION_NONE) {
105
		throw new JspTagException(
104
                throw new JspTagException(
106
                    Resources.getMessage("TRANSACTION_NO_SUPPORT"));
105
                        Resources.getMessage("TRANSACTION_NO_SUPPORT"));
107
	    }
106
            }
108
	    if ((isolation != Connection.TRANSACTION_NONE)
107
            if ((isolation != Connection.TRANSACTION_NONE)
109
		    && (isolation != origIsolation)) {
108
                    && (isolation != origIsolation)) {
110
		conn.setTransactionIsolation(isolation);
109
                conn.setTransactionIsolation(isolation);
111
	    }
110
            }
112
	    conn.setAutoCommit(false);
111
            conn.setAutoCommit(false);
113
	} catch (SQLException e) {
112
        } catch (SQLException e) {
114
	    throw new JspTagException(
113
            throw new JspTagException(
115
                Resources.getMessage("ERROR_GET_CONNECTION",
114
                    Resources.getMessage("ERROR_GET_CONNECTION",
116
				     e.toString()), e);
115
                            e.toString()), e);
117
	} 
116
        }
118
117
119
	return EVAL_BODY_INCLUDE;
118
        return EVAL_BODY_INCLUDE;
120
    }
119
    }
121
120
122
    /**
121
    /**
Lines 124-151 Link Here
124
     */
123
     */
125
    @Override
124
    @Override
126
    public int doEndTag() throws JspException {
125
    public int doEndTag() throws JspException {
127
	try {
126
        try {
128
	    conn.commit();
127
            conn.commit();
129
	} catch (SQLException e) {
128
        } catch (SQLException e) {
130
	    throw new JspTagException(
129
            throw new JspTagException(
131
                Resources.getMessage("TRANSACTION_COMMIT_ERROR",
130
                    Resources.getMessage("TRANSACTION_COMMIT_ERROR",
132
				     e.toString()), e);
131
                            e.toString()), e);
133
	}
132
        }
134
	return EVAL_PAGE;
133
        return EVAL_PAGE;
135
    }
134
    }
136
135
137
    /**
136
    /**
138
     * Rollbacks the transaction and rethrows the Throwable.
137
     * Rollbacks the transaction and rethrows the Throwable.
139
     */
138
     */
140
    public void doCatch(Throwable t) throws Throwable {
139
    public void doCatch(Throwable t) throws Throwable {
141
	if (conn != null) {
140
        if (conn != null) {
142
	    try {
141
            try {
143
		conn.rollback();
142
                conn.rollback();
144
	    } catch (SQLException e) {
143
            } catch (SQLException e) {
145
		// Ignore to not hide orignal exception
144
                // Ignore to not hide orignal exception
146
	    }
145
            }
147
	}
146
        }
148
	throw t;
147
        throw t;
149
    }
148
    }
150
149
151
    /**
150
    /**
Lines 153-179 Link Here
153
     * closes it.
152
     * closes it.
154
     */
153
     */
155
    public void doFinally() {
154
    public void doFinally() {
156
	if (conn != null) {
155
        if (conn != null) {
157
	    try {
156
            try {
158
		if ((isolation != Connection.TRANSACTION_NONE)
157
                if ((isolation != Connection.TRANSACTION_NONE)
159
		        && (isolation != origIsolation)) {
158
                        && (isolation != origIsolation)) {
160
		    conn.setTransactionIsolation(origIsolation);
159
                    conn.setTransactionIsolation(origIsolation);
161
		}
160
                }
162
		conn.setAutoCommit(true);
161
                conn.setAutoCommit(true);
163
		conn.close();
162
                conn.close();
164
	    } catch (SQLException e) {
163
            } catch (SQLException e) {
165
		// Not much we can do
164
                // Not much we can do
166
	    }
165
            }
167
	}
166
        }
168
	conn = null;
167
        conn = null;
169
	isolation = Connection.TRANSACTION_NONE;
168
        isolation = Connection.TRANSACTION_NONE;
170
    }
169
    }
171
170
172
    // Releases any resources we may have (or inherit)
171
    // Releases any resources we may have (or inherit)
172
173
    @Override
173
    @Override
174
    public void release() {
174
    public void release() {
175
	dataSourceSpecified = false;
175
        dataSourceSpecified = false;
176
	rawDataSource = null;
176
        rawDataSource = null;
177
    }
177
    }
178
178
179
179
Lines 185-202 Link Here
185
     */
185
     */
186
    public void setIsolation(String iso) throws JspTagException {
186
    public void setIsolation(String iso) throws JspTagException {
187
187
188
	if (TRANSACTION_READ_COMMITTED.equals(iso)) {
188
        if (TRANSACTION_READ_COMMITTED.equals(iso)) {
189
	    isolation = Connection.TRANSACTION_READ_COMMITTED;
189
            isolation = Connection.TRANSACTION_READ_COMMITTED;
190
	} else if (TRANSACTION_READ_UNCOMMITTED.equals(iso)) {
190
        } else if (TRANSACTION_READ_UNCOMMITTED.equals(iso)) {
191
	    isolation = Connection.TRANSACTION_READ_UNCOMMITTED;
191
            isolation = Connection.TRANSACTION_READ_UNCOMMITTED;
192
	} else if (TRANSACTION_REPEATABLE_READ.equals(iso)) {
192
        } else if (TRANSACTION_REPEATABLE_READ.equals(iso)) {
193
	    isolation = Connection.TRANSACTION_REPEATABLE_READ;
193
            isolation = Connection.TRANSACTION_REPEATABLE_READ;
194
	} else if (TRANSACTION_SERIALIZABLE.equals(iso)) {
194
        } else if (TRANSACTION_SERIALIZABLE.equals(iso)) {
195
	    isolation = Connection.TRANSACTION_SERIALIZABLE;
195
            isolation = Connection.TRANSACTION_SERIALIZABLE;
196
	} else {
196
        } else {
197
	    throw new JspTagException(
197
            throw new JspTagException(
198
                Resources.getMessage("TRANSACTION_INVALID_ISOLATION"));
198
                    Resources.getMessage("TRANSACTION_INVALID_ISOLATION"));
199
	}
199
        }
200
    }
200
    }
201
201
202
    /**
202
    /**
Lines 204-209 Link Here
204
     * the Connection.
204
     * the Connection.
205
     */
205
     */
206
    public Connection getSharedConnection() {
206
    public Connection getSharedConnection() {
207
	return conn;
207
        return conn;
208
    }
208
    }
209
}
209
}
(-)src/main/java/org/apache/taglibs/standard/tag/common/xml/UnresolvableException.java (-2 / +4 lines)
Lines 27-44 Link Here
27
    /**
27
    /**
28
     * Create an UnresolvableException object that holds
28
     * Create an UnresolvableException object that holds
29
     * an error message.
29
     * an error message.
30
     *
30
     * @param message The error message.
31
     * @param message The error message.
31
     */
32
     */
32
    public UnresolvableException(String message) {
33
    public UnresolvableException(String message) {
33
        super(message);
34
        super(message);
34
    }
35
    }
35
    
36
36
    /**
37
    /**
37
     * Create an UnresolvableException object that holds
38
     * Create an UnresolvableException object that holds
38
     * an error message, and another exception
39
     * an error message, and another exception
39
     * that caused this exception.
40
     * that caused this exception.
41
     *
40
     * @param message The error message.
42
     * @param message The error message.
41
     * @param e The exception that caused this exception.
43
     * @param e       The exception that caused this exception.
42
     */
44
     */
43
    public UnresolvableException(String message, Exception e) {
45
    public UnresolvableException(String message, Exception e) {
44
        super(message, e);
46
        super(message, e);
(-)src/main/java/org/apache/taglibs/standard/tag/common/xml/XPathUtil.java (-393 / +392 lines)
Lines 57-101 Link Here
57
// would ideally be a base class, but some of our user handlers already
57
// would ideally be a base class, but some of our user handlers already
58
// have their own parents
58
// have their own parents
59
public class XPathUtil {
59
public class XPathUtil {
60
    
60
61
    //*********************************************************************
61
    //*********************************************************************
62
    // Constructor
62
    // Constructor
63
    
63
64
    /**
64
    /**
65
     * Constructs a new XPathUtil object associated with the given
65
     * Constructs a new XPathUtil object associated with the given
66
     * PageContext.
66
     * PageContext.
67
     */
67
     */
68
    public XPathUtil(PageContext pc) {
68
    public XPathUtil(PageContext pc) {
69
        pageContext = pc;
69
        pageContext = pc;
70
    }    
70
    }
71
    
72
    int globalVarSize=0;
73
    public Vector getVariableQNames ( ) {
74
71
72
    int globalVarSize = 0;
73
74
    public Vector getVariableQNames() {
75
75
        globalVarSize = 0;
76
        globalVarSize = 0;
76
        Vector variableVector = new Vector ( );
77
        Vector variableVector = new Vector();
77
        // Now construct attributes in different scopes
78
        // Now construct attributes in different scopes
78
        Enumeration enum_ = pageContext.getAttributeNamesInScope( 
79
        Enumeration enum_ = pageContext.getAttributeNamesInScope(
79
            PageContext.PAGE_SCOPE );
80
                PageContext.PAGE_SCOPE);
80
        while ( enum_.hasMoreElements() ) {
81
        while (enum_.hasMoreElements()) {
81
            String varName = (String)enum_.nextElement();
82
            String varName = (String) enum_.nextElement();
82
            QName varQName = new QName ( PAGE_NS_URL, PAGE_P, varName); 
83
            QName varQName = new QName(PAGE_NS_URL, PAGE_P, varName);
83
            //Adding both namespace qualified QName and just localName
84
            //Adding both namespace qualified QName and just localName
84
            variableVector.addElement( varQName );
85
            variableVector.addElement(varQName);
85
            globalVarSize++;
86
            globalVarSize++;
86
            
87
87
            variableVector.addElement( new QName(null, varName ) );
88
            variableVector.addElement(new QName(null, varName));
88
            globalVarSize++;
89
            globalVarSize++;
89
        }
90
        }
90
        enum_ = pageContext.getAttributeNamesInScope( 
91
        enum_ = pageContext.getAttributeNamesInScope(
91
            PageContext.REQUEST_SCOPE );
92
                PageContext.REQUEST_SCOPE);
92
        while ( enum_.hasMoreElements() ) {
93
        while (enum_.hasMoreElements()) {
93
            String varName = (String)enum_.nextElement();
94
            String varName = (String) enum_.nextElement();
94
            QName varQName = new QName ( REQUEST_NS_URL,REQUEST_P, varName); 
95
            QName varQName = new QName(REQUEST_NS_URL, REQUEST_P, varName);
95
            //Adding both namespace qualified QName and just localName
96
            //Adding both namespace qualified QName and just localName
96
            variableVector.addElement( varQName );
97
            variableVector.addElement(varQName);
97
            globalVarSize++;
98
            globalVarSize++;
98
            variableVector.addElement( new QName(null, varName ) );
99
            variableVector.addElement(new QName(null, varName));
99
            globalVarSize++;
100
            globalVarSize++;
100
        }
101
        }
101
102
Lines 103-192 Link Here
103
            // we may have a page directive preventing session creation/access
104
            // we may have a page directive preventing session creation/access
104
            // do not attempt to retrieve attribute names in session scope
105
            // do not attempt to retrieve attribute names in session scope
105
            // @see [ http://issues.apache.org/bugzilla/show_bug.cgi?id=35216 ]
106
            // @see [ http://issues.apache.org/bugzilla/show_bug.cgi?id=35216 ]
106
            enum_ = pageContext.getAttributeNamesInScope( 
107
            enum_ = pageContext.getAttributeNamesInScope(
107
                PageContext.SESSION_SCOPE );
108
                    PageContext.SESSION_SCOPE);
108
            while ( enum_.hasMoreElements() ) {
109
            while (enum_.hasMoreElements()) {
109
                String varName = (String)enum_.nextElement();
110
                String varName = (String) enum_.nextElement();
110
                QName varQName = new QName ( SESSION_NS_URL, SESSION_P,varName); 
111
                QName varQName = new QName(SESSION_NS_URL, SESSION_P, varName);
111
                //Adding both namespace qualified QName and just localName
112
                //Adding both namespace qualified QName and just localName
112
                variableVector.addElement( varQName );
113
                variableVector.addElement(varQName);
113
                globalVarSize++;
114
                globalVarSize++;
114
                variableVector.addElement( new QName(null, varName ) );
115
                variableVector.addElement(new QName(null, varName));
115
                globalVarSize++;
116
                globalVarSize++;
116
            }
117
            }
117
        }
118
        }
118
119
119
        enum_ = pageContext.getAttributeNamesInScope( 
120
        enum_ = pageContext.getAttributeNamesInScope(
120
            PageContext.APPLICATION_SCOPE );
121
                PageContext.APPLICATION_SCOPE);
121
        while ( enum_.hasMoreElements() ) {
122
        while (enum_.hasMoreElements()) {
122
            String varName = (String)enum_.nextElement();
123
            String varName = (String) enum_.nextElement();
123
            QName varQName = new QName ( APP_NS_URL, APP_P,varName ); 
124
            QName varQName = new QName(APP_NS_URL, APP_P, varName);
124
            //Adding both namespace qualified QName and just localName
125
            //Adding both namespace qualified QName and just localName
125
            variableVector.addElement( varQName );
126
            variableVector.addElement(varQName);
126
            globalVarSize++;
127
            globalVarSize++;
127
            variableVector.addElement( new QName(null, varName ) );
128
            variableVector.addElement(new QName(null, varName));
128
            globalVarSize++;
129
            globalVarSize++;
129
        }
130
        }
130
        enum_ = pageContext.getRequest().getParameterNames();
131
        enum_ = pageContext.getRequest().getParameterNames();
131
        while ( enum_.hasMoreElements() ) {
132
        while (enum_.hasMoreElements()) {
132
            String varName = (String)enum_.nextElement();
133
            String varName = (String) enum_.nextElement();
133
            QName varQName = new QName ( PARAM_NS_URL, PARAM_P,varName ); 
134
            QName varQName = new QName(PARAM_NS_URL, PARAM_P, varName);
134
            //Adding both namespace qualified QName and just localName
135
            //Adding both namespace qualified QName and just localName
135
            variableVector.addElement( varQName );
136
            variableVector.addElement(varQName);
136
            globalVarSize++;
137
            globalVarSize++;
137
        }
138
        }
138
        enum_ = pageContext.getServletContext().getInitParameterNames();
139
        enum_ = pageContext.getServletContext().getInitParameterNames();
139
        while ( enum_.hasMoreElements() ) {
140
        while (enum_.hasMoreElements()) {
140
            String varName = (String)enum_.nextElement();
141
            String varName = (String) enum_.nextElement();
141
            QName varQName = new QName ( INITPARAM_NS_URL, INITPARAM_P,varName ); 
142
            QName varQName = new QName(INITPARAM_NS_URL, INITPARAM_P, varName);
142
            //Adding both namespace qualified QName and just localName
143
            //Adding both namespace qualified QName and just localName
143
            variableVector.addElement( varQName );
144
            variableVector.addElement(varQName);
144
            globalVarSize++;
145
            globalVarSize++;
145
        }
146
        }
146
        enum_ = ((HttpServletRequest)pageContext.getRequest()).getHeaderNames();
147
        enum_ = ((HttpServletRequest) pageContext.getRequest()).getHeaderNames();
147
        while ( enum_.hasMoreElements() ) {
148
        while (enum_.hasMoreElements()) {
148
            String varName = (String)enum_.nextElement();
149
            String varName = (String) enum_.nextElement();
149
            QName varQName = new QName ( HEADER_NS_URL, HEADER_P,varName ); 
150
            QName varQName = new QName(HEADER_NS_URL, HEADER_P, varName);
150
            //Adding namespace qualified QName 
151
            //Adding namespace qualified QName 
151
            variableVector.addElement( varQName );
152
            variableVector.addElement(varQName);
152
            globalVarSize++;
153
            globalVarSize++;
153
        }
154
        }
154
        Cookie[] c= ((HttpServletRequest)pageContext.getRequest()).getCookies();
155
        Cookie[] c = ((HttpServletRequest) pageContext.getRequest()).getCookies();
155
        if ( c!= null ) {
156
        if (c != null) {
156
	    for (int i = 0; i < c.length; i++) {
157
            for (int i = 0; i < c.length; i++) {
157
	        String varName = c[i].getName();
158
                String varName = c[i].getName();
158
                QName varQName = new QName ( COOKIE_NS_URL, COOKIE_P,varName ); 
159
                QName varQName = new QName(COOKIE_NS_URL, COOKIE_P, varName);
159
                //Adding namespace qualified QName 
160
                //Adding namespace qualified QName 
160
                variableVector.addElement( varQName );
161
                variableVector.addElement(varQName);
161
                globalVarSize++;
162
                globalVarSize++;
162
            }
163
            }
163
        }
164
        }
164
165
165
        return variableVector;
166
        return variableVector;
166
        
167
167
    }
168
    }
168
 
169
169
    //*********************************************************************
170
    //*********************************************************************
170
    // Support for JSTL variable resolution
171
    // Support for JSTL variable resolution
171
    
172
172
    // The URLs
173
    // The URLs
173
    private static final String PAGE_NS_URL
174
    private static final String PAGE_NS_URL
174
    = "http://java.sun.com/jstl/xpath/page";
175
            = "http://java.sun.com/jstl/xpath/page";
175
    private static final String REQUEST_NS_URL
176
    private static final String REQUEST_NS_URL
176
    = "http://java.sun.com/jstl/xpath/request";
177
            = "http://java.sun.com/jstl/xpath/request";
177
    private static final String SESSION_NS_URL
178
    private static final String SESSION_NS_URL
178
    = "http://java.sun.com/jstl/xpath/session";
179
            = "http://java.sun.com/jstl/xpath/session";
179
    private static final String APP_NS_URL
180
    private static final String APP_NS_URL
180
    = "http://java.sun.com/jstl/xpath/app";
181
            = "http://java.sun.com/jstl/xpath/app";
181
    private static final String PARAM_NS_URL
182
    private static final String PARAM_NS_URL
182
    = "http://java.sun.com/jstl/xpath/param";
183
            = "http://java.sun.com/jstl/xpath/param";
183
    private static final String INITPARAM_NS_URL
184
    private static final String INITPARAM_NS_URL
184
    = "http://java.sun.com/jstl/xpath/initParam";
185
            = "http://java.sun.com/jstl/xpath/initParam";
185
    private static final String COOKIE_NS_URL
186
    private static final String COOKIE_NS_URL
186
    = "http://java.sun.com/jstl/xpath/cookie";
187
            = "http://java.sun.com/jstl/xpath/cookie";
187
    private static final String HEADER_NS_URL
188
    private static final String HEADER_NS_URL
188
    = "http://java.sun.com/jstl/xpath/header";
189
            = "http://java.sun.com/jstl/xpath/header";
189
    
190
190
    // The prefixes
191
    // The prefixes
191
    private static final String PAGE_P = "pageScope";
192
    private static final String PAGE_P = "pageScope";
192
    private static final String REQUEST_P = "requestScope";
193
    private static final String REQUEST_P = "requestScope";
Lines 196-389 Link Here
196
    private static final String INITPARAM_P = "initParam";
197
    private static final String INITPARAM_P = "initParam";
197
    private static final String COOKIE_P = "cookie";
198
    private static final String COOKIE_P = "cookie";
198
    private static final String HEADER_P = "header";
199
    private static final String HEADER_P = "header";
199
    
200
200
    /**
201
    /**
201
     * org.apache.xpath.VariableStack defines a class to keep track of a stack 
202
     * org.apache.xpath.VariableStack defines a class to keep track of a stack
202
     * for template arguments and variables. 
203
     * for template arguments and variables.
203
     * JstlVariableContext customizes it so it handles JSTL custom
204
     * JstlVariableContext customizes it so it handles JSTL custom
204
     * variable-mapping rules.
205
     * variable-mapping rules.
205
     */
206
     */
206
    protected class JstlVariableContext extends org.apache.xpath.VariableStack {
207
    protected class JstlVariableContext extends org.apache.xpath.VariableStack {
207
        
208
208
        public JstlVariableContext( ) {
209
        public JstlVariableContext() {
209
            super();
210
            super();
210
        }
211
        }
211
        
212
212
        /**
213
        /**
213
         * Get a variable as an XPath object based on it's qualified name.
214
         * Get a variable as an XPath object based on it's qualified name.
214
         * We override the base class method so JSTL's custom variable-mapping 
215
         * We override the base class method so JSTL's custom variable-mapping
215
         * rules can be applied.
216
         * rules can be applied.
216
         *
217
         *
217
         * @param xctxt The XPath context. @@@ we don't use it...
218
         * @param xctxt The XPath context. @@@ we don't use it...
218
         *  (from xalan: which must be passed in order to lazy evaluate variables.)
219
         *              (from xalan: which must be passed in order to lazy evaluate variables.)
219
         * @param qname The qualified name of the variable.
220
         * @param qname The qualified name of the variable.
220
         */
221
         */
221
        @Override
222
        @Override
222
        public XObject getVariableOrParam(
223
        public XObject getVariableOrParam(
223
        XPathContext xctxt, 
224
                XPathContext xctxt,
224
        org.apache.xml.utils.QName qname)
225
                org.apache.xml.utils.QName qname)
225
        throws javax.xml.transform.TransformerException, UnresolvableException
226
                throws javax.xml.transform.TransformerException, UnresolvableException {
226
        {
227
            //p( "***********************************getVariableOrParam begin****");
227
            //p( "***********************************getVariableOrParam begin****");
228
            String namespace = qname.getNamespaceURI();
228
            String namespace = qname.getNamespaceURI();
229
            String prefix = qname.getPrefix();
229
            String prefix = qname.getPrefix();
230
            String localName = qname.getLocalName();
230
            String localName = qname.getLocalName();
231
            
231
232
            //p("namespace:prefix:localname=>"+ namespace
232
            //p("namespace:prefix:localname=>"+ namespace
233
            //     + ":" + prefix +":" + localName );
233
            //     + ":" + prefix +":" + localName );
234
            
234
235
            try {
235
            try {
236
                Object varObject = getVariableValue(namespace,prefix,localName);
236
                Object varObject = getVariableValue(namespace, prefix, localName);
237
237
238
238
239
                //XObject varObject = myvs.getVariableOrParam( xpathSupport, varQName);
239
                //XObject varObject = myvs.getVariableOrParam( xpathSupport, varQName);
240
                XObject newXObject = new XObject( varObject);
240
                XObject newXObject = new XObject(varObject);
241
241
242
                if ( Class.forName("org.w3c.dom.Document").isInstance( varObject) ) {
242
                if (Class.forName("org.w3c.dom.Document").isInstance(varObject)) {
243
243
244
                    NodeList nl= ((Document)varObject).getChildNodes();
244
                    NodeList nl = ((Document) varObject).getChildNodes();
245
                    // To allow non-welformed document
245
                    // To allow non-welformed document
246
                    Vector nodeVector = new Vector();
246
                    Vector nodeVector = new Vector();
247
                    for ( int i=0; i<nl.getLength(); i++ ) {
247
                    for (int i = 0; i < nl.getLength(); i++) {
248
                        Node currNode = nl.item(i);
248
                        Node currNode = nl.item(i);
249
                        if ( currNode.getNodeType() == Node.ELEMENT_NODE ) {
249
                        if (currNode.getNodeType() == Node.ELEMENT_NODE) {
250
                            nodeVector.addElement( currNode);
250
                            nodeVector.addElement(currNode);
251
                        }
251
                        }
252
                    }
252
                    }
253
                    JSTLNodeList jstlNodeList = new JSTLNodeList( nodeVector);
253
                    JSTLNodeList jstlNodeList = new JSTLNodeList(nodeVector);
254
                    newXObject = new XNodeSetForDOM( jstlNodeList, xctxt );
254
                    newXObject = new XNodeSetForDOM(jstlNodeList, xctxt);
255
                    
255
256
                    return newXObject;
256
                    return newXObject;
257
                   
257
258
                } 
258
                }
259
                if ( Class.forName(
259
                if (Class.forName(
260
        "org.apache.taglibs.standard.tag.common.xml.JSTLNodeList").isInstance(
260
                        "org.apache.taglibs.standard.tag.common.xml.JSTLNodeList").isInstance(
261
                     varObject) ) {
261
                        varObject)) {
262
                    JSTLNodeList jstlNodeList = (JSTLNodeList)varObject;
262
                    JSTLNodeList jstlNodeList = (JSTLNodeList) varObject;
263
                    if  ( ( jstlNodeList.getLength() == 1 ) && 
263
                    if ((jstlNodeList.getLength() == 1) &&
264
   (!Class.forName("org.w3c.dom.Node").isInstance( jstlNodeList.elementAt(0) ) ) ) { 
264
                            (!Class.forName("org.w3c.dom.Node").isInstance(jstlNodeList.elementAt(0)))) {
265
                        varObject = jstlNodeList.elementAt(0);
265
                        varObject = jstlNodeList.elementAt(0);
266
                        //Now we need to allow this primitive type to be coverted 
266
                        //Now we need to allow this primitive type to be coverted 
267
                        // to type which Xalan XPath understands 
267
                        // to type which Xalan XPath understands 
268
                    } else {
268
                    } else {
269
                        return new XNodeSetForDOM (  jstlNodeList ,xctxt );
269
                        return new XNodeSetForDOM(jstlNodeList, xctxt);
270
                    }
270
                    }
271
                } 
271
                }
272
                if (Class.forName("org.w3c.dom.Node").isInstance( varObject)) {
272
                if (Class.forName("org.w3c.dom.Node").isInstance(varObject)) {
273
                    newXObject = new XNodeSetForDOM ( new JSTLNodeList( (Node)varObject ),xctxt );
273
                    newXObject = new XNodeSetForDOM(new JSTLNodeList((Node) varObject), xctxt);
274
                } else if ( Class.forName("java.lang.String").isInstance( varObject)){
274
                } else if (Class.forName("java.lang.String").isInstance(varObject)) {
275
                    newXObject = new XString ( (String)varObject );
275
                    newXObject = new XString((String) varObject);
276
                } else if ( Class.forName("java.lang.Boolean").isInstance( varObject) ) {
276
                } else if (Class.forName("java.lang.Boolean").isInstance(varObject)) {
277
                    newXObject = new XBoolean ( (Boolean)varObject );
277
                    newXObject = new XBoolean((Boolean) varObject);
278
                } else if ( Class.forName("java.lang.Number").isInstance( varObject) ) {
278
                } else if (Class.forName("java.lang.Number").isInstance(varObject)) {
279
                    newXObject = new XNumber ( (Number)varObject );
279
                    newXObject = new XNumber((Number) varObject);
280
                } 
280
                }
281
281
282
                return newXObject;
282
                return newXObject;
283
               // myvs.setGlobalVariable( i, newXObject );
283
                // myvs.setGlobalVariable( i, newXObject );
284
            } catch ( ClassNotFoundException cnfe ) {
284
            } catch (ClassNotFoundException cnfe) {
285
                // This shouldn't happen (TODO: LOG)
285
                // This shouldn't happen (TODO: LOG)
286
                System.out.println("CLASS NOT FOUND EXCEPTION :" + cnfe );
286
                System.out.println("CLASS NOT FOUND EXCEPTION :" + cnfe);
287
            } 
287
            }
288
            //System.out.println("*****getVariableOrParam returning *null*" );
288
            //System.out.println("*****getVariableOrParam returning *null*" );
289
            return null ;
289
            return null;
290
        }
290
        }
291
        
291
292
        /**
292
        /**
293
         * Retrieve an XPath's variable value using JSTL's custom 
293
         * Retrieve an XPath's variable value using JSTL's custom
294
         * variable-mapping rules
294
         * variable-mapping rules
295
         */
295
         */
296
        public Object getVariableValue(
296
        public Object getVariableValue(
297
        String namespace, 
297
                String namespace,
298
        String prefix,
298
                String prefix,
299
        String localName) 
299
                String localName)
300
        throws UnresolvableException 
300
                throws UnresolvableException {
301
        {
302
            // p("resolving: ns=" + namespace + " prefix=" + prefix + " localName=" + localName);
301
            // p("resolving: ns=" + namespace + " prefix=" + prefix + " localName=" + localName);
303
            // We can match on namespace with Xalan but leaving as is
302
            // We can match on namespace with Xalan but leaving as is
304
            // [ I 'd prefer to match on namespace, but this doesn't appear
303
            // [ I 'd prefer to match on namespace, but this doesn't appear
305
            // to work in Jaxen]
304
            // to work in Jaxen]
306
            if (prefix == null || prefix.equals("")) {
305
            if (prefix == null || prefix.equals("")) {
307
                return notNull(
306
                return notNull(
308
                pageContext.findAttribute(localName),
307
                        pageContext.findAttribute(localName),
309
                prefix,
308
                        prefix,
310
                localName);
309
                        localName);
311
            } else if (prefix.equals(PAGE_P)) {
310
            } else if (prefix.equals(PAGE_P)) {
312
                return notNull(
311
                return notNull(
313
                pageContext.getAttribute(localName,PageContext.PAGE_SCOPE),
312
                        pageContext.getAttribute(localName, PageContext.PAGE_SCOPE),
314
                prefix,
313
                        prefix,
315
                localName);
314
                        localName);
316
            } else if (prefix.equals(REQUEST_P)) {
315
            } else if (prefix.equals(REQUEST_P)) {
317
                return notNull(
316
                return notNull(
318
                pageContext.getAttribute(localName,
317
                        pageContext.getAttribute(localName,
319
                PageContext.REQUEST_SCOPE),
318
                                PageContext.REQUEST_SCOPE),
320
                prefix,
319
                        prefix,
321
                localName);
320
                        localName);
322
            } else if (prefix.equals(SESSION_P)) {
321
            } else if (prefix.equals(SESSION_P)) {
323
                return notNull(
322
                return notNull(
324
                pageContext.getAttribute(localName,
323
                        pageContext.getAttribute(localName,
325
                PageContext.SESSION_SCOPE),
324
                                PageContext.SESSION_SCOPE),
326
                prefix,
325
                        prefix,
327
                localName);
326
                        localName);
328
            } else if (prefix.equals(APP_P)) {
327
            } else if (prefix.equals(APP_P)) {
329
                return notNull(
328
                return notNull(
330
                pageContext.getAttribute(localName,
329
                        pageContext.getAttribute(localName,
331
                PageContext.APPLICATION_SCOPE),
330
                                PageContext.APPLICATION_SCOPE),
332
                prefix,
331
                        prefix,
333
                localName);
332
                        localName);
334
            } else if (prefix.equals(PARAM_P)) {
333
            } else if (prefix.equals(PARAM_P)) {
335
                return notNull(
334
                return notNull(
336
                pageContext.getRequest().getParameter(localName),
335
                        pageContext.getRequest().getParameter(localName),
337
                prefix,
336
                        prefix,
338
                localName);
337
                        localName);
339
            } else if (prefix.equals(INITPARAM_P)) {
338
            } else if (prefix.equals(INITPARAM_P)) {
340
                return notNull(
339
                return notNull(
341
                pageContext.getServletContext().
340
                        pageContext.getServletContext().
342
                getInitParameter(localName),
341
                                getInitParameter(localName),
343
                prefix,
342
                        prefix,
344
                localName);
343
                        localName);
345
            } else if (prefix.equals(HEADER_P)) {
344
            } else if (prefix.equals(HEADER_P)) {
346
                HttpServletRequest hsr =
345
                HttpServletRequest hsr =
347
                (HttpServletRequest) pageContext.getRequest();
346
                        (HttpServletRequest) pageContext.getRequest();
348
                return notNull(
347
                return notNull(
349
                hsr.getHeader(localName),
348
                        hsr.getHeader(localName),
350
                prefix,
349
                        prefix,
351
                localName);
350
                        localName);
352
            } else if (prefix.equals(COOKIE_P)) {
351
            } else if (prefix.equals(COOKIE_P)) {
353
                HttpServletRequest hsr =
352
                HttpServletRequest hsr =
354
                (HttpServletRequest) pageContext.getRequest();
353
                        (HttpServletRequest) pageContext.getRequest();
355
                Cookie[] c = hsr.getCookies();
354
                Cookie[] c = hsr.getCookies();
356
                for (int i = 0; i < c.length; i++)
355
                for (int i = 0; i < c.length; i++) {
357
                    if (c[i].getName().equals(localName))
356
                    if (c[i].getName().equals(localName)) {
358
                        return c[i].getValue();
357
                        return c[i].getValue();
358
                    }
359
                }
359
                throw new UnresolvableException("$" + prefix + ":" + localName);
360
                throw new UnresolvableException("$" + prefix + ":" + localName);
360
            } else {
361
            } else {
361
                throw new UnresolvableException("$" + prefix + ":" + localName);
362
                throw new UnresolvableException("$" + prefix + ":" + localName);
362
            }
363
            }
363
        }    
364
        }
364
        
365
365
        /**
366
        /**
366
         * Validate that the Object returned is not null. If it is
367
         * Validate that the Object returned is not null. If it is
367
         * null, throw an exception.
368
         * null, throw an exception.
368
         */
369
         */
369
        private Object notNull(Object o, String prefix, String localName)
370
        private Object notNull(Object o, String prefix, String localName)
370
        throws UnresolvableException {
371
                throws UnresolvableException {
371
            if (o == null) {
372
            if (o == null) {
372
                throw new UnresolvableException("$" + (prefix==null?"":prefix+":") + localName);
373
                throw new UnresolvableException("$" + (prefix == null ? "" : prefix + ":") + localName);
373
            }
374
            }
374
            //p("resolved to: " + o);
375
            //p("resolved to: " + o);
375
            return o;
376
            return o;
376
        }                
377
        }
377
    }
378
    }
378
    
379
379
    //*********************************************************************
380
    //*********************************************************************
380
    // Support for XPath evaluation
381
    // Support for XPath evaluation
381
    
382
382
    private PageContext pageContext;
383
    private PageContext pageContext;
383
    private static HashMap exprCache;
384
    private static HashMap exprCache;
384
    private static JSTLPrefixResolver jstlPrefixResolver = null;
385
    private static JSTLPrefixResolver jstlPrefixResolver = null;
385
    
386
386
    /** Initialize globally useful data. */
387
    /**
388
     * Initialize globally useful data.
389
     */
387
    private synchronized static void staticInit() {
390
    private synchronized static void staticInit() {
388
        if (jstlPrefixResolver == null) {
391
        if (jstlPrefixResolver == null) {
389
            // register supported namespaces
392
            // register supported namespaces
Lines 396-443 Link Here
396
            jstlPrefixResolver.addNamespace("initParam", INITPARAM_NS_URL);
399
            jstlPrefixResolver.addNamespace("initParam", INITPARAM_NS_URL);
397
            jstlPrefixResolver.addNamespace("header", HEADER_NS_URL);
400
            jstlPrefixResolver.addNamespace("header", HEADER_NS_URL);
398
            jstlPrefixResolver.addNamespace("cookie", COOKIE_NS_URL);
401
            jstlPrefixResolver.addNamespace("cookie", COOKIE_NS_URL);
399
            
402
400
            
403
401
            // create a HashMap to cache the expressions
404
            // create a HashMap to cache the expressions
402
            exprCache = new HashMap();
405
            exprCache = new HashMap();
403
        }
406
        }
404
    }
407
    }
405
    
408
406
    static DocumentBuilderFactory dbf = null;
409
    static DocumentBuilderFactory dbf = null;
407
    static DocumentBuilder db = null;
410
    static DocumentBuilder db = null;
408
    static Document d = null;
411
    static Document d = null;
409
    
412
410
    static Document getDummyDocument( ) {
413
    static Document getDummyDocument() {
411
        try {
414
        try {
412
            if ( dbf == null ) {
415
            if (dbf == null) {
413
                dbf = DocumentBuilderFactory.newInstance();
416
                dbf = DocumentBuilderFactory.newInstance();
414
                dbf.setNamespaceAware( true );
417
                dbf.setNamespaceAware(true);
415
                dbf.setValidating( false );
418
                dbf.setValidating(false);
416
            }
419
            }
417
            db = dbf.newDocumentBuilder();
420
            db = dbf.newDocumentBuilder();
418
421
419
            DOMImplementation dim = db.getDOMImplementation();
422
            DOMImplementation dim = db.getDOMImplementation();
420
            d = dim.createDocument("http://java.sun.com/jstl", "dummyroot", null); 
423
            d = dim.createDocument("http://java.sun.com/jstl", "dummyroot", null);
421
            //d = db.newDocument();
424
            //d = db.newDocument();
422
            return d;
425
            return d;
423
        } catch ( Exception e ) {
426
        } catch (Exception e) {
424
            e.printStackTrace();
427
            e.printStackTrace();
425
        }
428
        }
426
        return null;
429
        return null;
427
    }
430
    }
428
431
429
     static Document getDummyDocumentWithoutRoot( ) {
432
    static Document getDummyDocumentWithoutRoot() {
430
        try {
433
        try {
431
            if ( dbf == null ) {
434
            if (dbf == null) {
432
                dbf = DocumentBuilderFactory.newInstance();
435
                dbf = DocumentBuilderFactory.newInstance();
433
                dbf.setNamespaceAware( true );
436
                dbf.setNamespaceAware(true);
434
                dbf.setValidating( false );
437
                dbf.setValidating(false);
435
            }
438
            }
436
            db = dbf.newDocumentBuilder();
439
            db = dbf.newDocumentBuilder();
437
440
438
            d = db.newDocument();
441
            d = db.newDocument();
439
            return d;
442
            return d;
440
        } catch ( Exception e ) {
443
        } catch (Exception e) {
441
            e.printStackTrace();
444
            e.printStackTrace();
442
        }
445
        }
443
        return null;
446
        return null;
Lines 449-545 Link Here
449
        doc.appendChild(importedNode);
452
        doc.appendChild(importedNode);
450
        return doc;
453
        return doc;
451
    }
454
    }
452
    
455
453
    // The following variable is used for holding the modified xpath string
456
    // The following variable is used for holding the modified xpath string
454
    // when adapting parameter for Xalan XPath engine, where we need to have
457
    // when adapting parameter for Xalan XPath engine, where we need to have
455
    // a Non null context node.
458
    // a Non null context node.
456
    String modifiedXPath = null;
459
    String modifiedXPath = null;
457
    
458
460
459
    
461
460
    
461
    
462
    /**
462
    /**
463
     * Evaluate an XPath expression to a String value. 
463
     * Evaluate an XPath expression to a String value.
464
     */
464
     */
465
    public String valueOf(Node n, String xpath) throws JspTagException  {
465
    public String valueOf(Node n, String xpath) throws JspTagException {
466
        //p("******** valueOf(" + n + ", " + xpath + ")");
466
        //p("******** valueOf(" + n + ", " + xpath + ")");
467
        staticInit();
467
        staticInit();
468
        // @@@ but where do we set the Pag4eContext for the varaiblecontext?
468
        // @@@ but where do we set the Pag4eContext for the varaiblecontext?
469
        JstlVariableContext vs = new JstlVariableContext();
469
        JstlVariableContext vs = new JstlVariableContext();
470
        XPathContext xpathSupport = new XPathContext();
470
        XPathContext xpathSupport = new XPathContext();
471
        xpathSupport.setVarStack( vs);
471
        xpathSupport.setVarStack(vs);
472
        
472
473
        Vector varVector = fillVarStack(vs, xpathSupport);                
473
        Vector varVector = fillVarStack(vs, xpathSupport);
474
        
474
475
        Node contextNode = adaptParamsForXalan( vs, n, xpath.trim() );
475
        Node contextNode = adaptParamsForXalan(vs, n, xpath.trim());
476
        
476
477
        xpath = modifiedXPath;
477
        xpath = modifiedXPath;
478
        
478
479
        //p("******** valueOf: modified xpath: " + xpath);
479
        //p("******** valueOf: modified xpath: " + xpath);
480
480
481
        XObject result = JSTLXPathAPI.eval( contextNode, xpath,
481
        XObject result = JSTLXPathAPI.eval(contextNode, xpath,
482
        jstlPrefixResolver,xpathSupport, varVector);
482
                jstlPrefixResolver, xpathSupport, varVector);
483
483
484
        
484
485
        //p("******Result TYPE => " + result.getTypeString() );
485
        //p("******Result TYPE => " + result.getTypeString() );
486
        
486
487
        String resultString = result.str();
487
        String resultString = result.str();
488
        //p("******** valueOf: after eval: " + resultString);
488
        //p("******** valueOf: after eval: " + resultString);
489
        
489
490
        return resultString;
490
        return resultString;
491
    
492
    }    
493
491
494
    /** 
492
    }
495
     * Evaluate an XPath expression to a boolean value. 
493
494
    /**
495
     * Evaluate an XPath expression to a boolean value.
496
     */
496
     */
497
    public boolean booleanValueOf(Node n, String xpath)
497
    public boolean booleanValueOf(Node n, String xpath)
498
    throws JspTagException {
498
            throws JspTagException {
499
        
499
500
        staticInit();
500
        staticInit();
501
        JstlVariableContext vs = new JstlVariableContext();
501
        JstlVariableContext vs = new JstlVariableContext();
502
        XPathContext xpathSupport = new XPathContext();
502
        XPathContext xpathSupport = new XPathContext();
503
        xpathSupport.setVarStack( vs);
503
        xpathSupport.setVarStack(vs);
504
        
504
505
        Vector varVector = fillVarStack(vs, xpathSupport);        
505
        Vector varVector = fillVarStack(vs, xpathSupport);
506
        
506
507
        Node contextNode = adaptParamsForXalan( vs, n, xpath.trim() );
507
        Node contextNode = adaptParamsForXalan(vs, n, xpath.trim());
508
        xpath = modifiedXPath;
508
        xpath = modifiedXPath;
509
        
509
510
        XObject result = JSTLXPathAPI.eval( contextNode, xpath,
510
        XObject result = JSTLXPathAPI.eval(contextNode, xpath,
511
        jstlPrefixResolver, xpathSupport, varVector);
511
                jstlPrefixResolver, xpathSupport, varVector);
512
        
512
513
        try {
513
        try {
514
            return result.bool();
514
            return result.bool();
515
        } catch (TransformerException ex) {
515
        } catch (TransformerException ex) {
516
            throw new JspTagException(
516
            throw new JspTagException(
517
                Resources.getMessage("XPATH_ERROR_XOBJECT", ex.toString()), ex);            
517
                    Resources.getMessage("XPATH_ERROR_XOBJECT", ex.toString()), ex);
518
        }
518
        }
519
    }
519
    }
520
    
520
521
    /** 
521
    /**
522
     * Evaluate an XPath expression to a List of nodes. 
522
     * Evaluate an XPath expression to a List of nodes.
523
     */
523
     */
524
    public List selectNodes(Node n, String xpath)  throws JspTagException {
524
    public List selectNodes(Node n, String xpath) throws JspTagException {
525
        
525
526
        staticInit();
526
        staticInit();
527
        JstlVariableContext vs = new JstlVariableContext();
527
        JstlVariableContext vs = new JstlVariableContext();
528
        XPathContext xpathSupport = new XPathContext();
528
        XPathContext xpathSupport = new XPathContext();
529
        xpathSupport.setVarStack( vs);
529
        xpathSupport.setVarStack(vs);
530
        
531
        Vector varVector = fillVarStack(vs, xpathSupport);                
532
530
533
        Node contextNode = adaptParamsForXalan( vs, n, xpath.trim() );
531
        Vector varVector = fillVarStack(vs, xpathSupport);
532
533
        Node contextNode = adaptParamsForXalan(vs, n, xpath.trim());
534
        xpath = modifiedXPath;
534
        xpath = modifiedXPath;
535
        
535
536
        XObject result = JSTLXPathAPI.eval( contextNode, xpath,
536
        XObject result = JSTLXPathAPI.eval(contextNode, xpath,
537
        jstlPrefixResolver,xpathSupport, varVector);
537
                jstlPrefixResolver, xpathSupport, varVector);
538
        try {
538
        try {
539
            NodeList nl= JSTLXPathAPI.getNodeList(result);
539
            NodeList nl = JSTLXPathAPI.getNodeList(result);
540
            return new JSTLNodeList( nl );
540
            return new JSTLNodeList(nl);
541
        } catch ( JspTagException e ) {
541
        } catch (JspTagException e) {
542
            try { 
542
            try {
543
                //If result can't be converted to NodeList we receive exception
543
                //If result can't be converted to NodeList we receive exception
544
                // In this case we may have single primitive value as the result
544
                // In this case we may have single primitive value as the result
545
                // Populating List with this value ( String, Boolean or Number )
545
                // Populating List with this value ( String, Boolean or Number )
Lines 547-700 Link Here
547
                //System.out.println("JSTLXPathAPI.getNodeList thrown exception:"+ e);
547
                //System.out.println("JSTLXPathAPI.getNodeList thrown exception:"+ e);
548
                Vector vector = new Vector();
548
                Vector vector = new Vector();
549
                Object resultObject = null;
549
                Object resultObject = null;
550
                if ( result.getType()== XObject.CLASS_BOOLEAN ) {
550
                if (result.getType() == XObject.CLASS_BOOLEAN) {
551
                    resultObject = new Boolean( result.bool());
551
                    resultObject = result.bool();
552
                } else if ( result.getType()== XObject.CLASS_NUMBER ) {
552
                } else if (result.getType() == XObject.CLASS_NUMBER) {
553
                    resultObject = new Double( result.num());
553
                    resultObject = result.num();
554
                } else if ( result.getType()== XObject.CLASS_STRING ) {
554
                } else if (result.getType() == XObject.CLASS_STRING) {
555
                    resultObject = result.str();
555
                    resultObject = result.str();
556
                }
556
                }
557
557
558
                vector.add( resultObject );
558
                vector.add(resultObject);
559
                return new JSTLNodeList ( vector );
559
                return new JSTLNodeList(vector);
560
            } catch ( TransformerException te ) {
560
            } catch (TransformerException te) {
561
                throw new JspTagException(te.toString(), te);
561
                throw new JspTagException(te.toString(), te);
562
            }
562
            }
563
        }
563
        }
564
          
564
565
        
565
566
       
567
    }
566
    }
568
    
567
569
    /** 
568
    /**
570
     * Evaluate an XPath expression to a single node. 
569
     * Evaluate an XPath expression to a single node.
571
     */
570
     */
572
    public Node selectSingleNode(Node n, String xpath)
571
    public Node selectSingleNode(Node n, String xpath)
573
    throws JspTagException {
572
            throws JspTagException {
574
        //p("selectSingleNode of XPathUtil = passed node:" +
573
        //p("selectSingleNode of XPathUtil = passed node:" +
575
        //   "xpath => " + n + " : " + xpath );
574
        //   "xpath => " + n + " : " + xpath );
576
        
575
577
        staticInit();
576
        staticInit();
578
        JstlVariableContext vs = new JstlVariableContext();
577
        JstlVariableContext vs = new JstlVariableContext();
579
        XPathContext xpathSupport = new XPathContext();
578
        XPathContext xpathSupport = new XPathContext();
580
        xpathSupport.setVarStack( vs);
579
        xpathSupport.setVarStack(vs);
581
        
582
        Vector varVector = fillVarStack(vs, xpathSupport);                
583
580
584
        Node contextNode = adaptParamsForXalan( vs, n, xpath.trim() );
581
        Vector varVector = fillVarStack(vs, xpathSupport);
582
583
        Node contextNode = adaptParamsForXalan(vs, n, xpath.trim());
585
        xpath = modifiedXPath;
584
        xpath = modifiedXPath;
586
        
585
587
        return (Node) JSTLXPathAPI.selectSingleNode( contextNode, xpath,
586
        return (Node) JSTLXPathAPI.selectSingleNode(contextNode, xpath,
588
        jstlPrefixResolver,xpathSupport );
587
                jstlPrefixResolver, xpathSupport);
589
    }
588
    }
590
    
589
591
    /** Returns a locally appropriate context given a node. */
590
    /**
591
     * Returns a locally appropriate context given a node.
592
     */
592
    private VariableStack getLocalContext() {
593
    private VariableStack getLocalContext() {
593
        // set up instance-specific contexts
594
        // set up instance-specific contexts
594
        VariableStack vc = new JstlVariableContext();
595
        VariableStack vc = new JstlVariableContext();
595
        return vc;
596
        return vc;
596
    }    
597
    }
597
    
598
598
    //*********************************************************************
599
    //*********************************************************************
599
    // Adapt XPath expression for integration with Xalan
600
    // Adapt XPath expression for integration with Xalan
600
   
601
601
    /**
602
    /**
602
     * To evaluate an XPath expression using Xalan, we need 
603
     * To evaluate an XPath expression using Xalan, we need
603
     * to create an XPath object, which wraps an expression object and provides 
604
     * to create an XPath object, which wraps an expression object and provides
604
     * general services for execution of that expression.
605
     * general services for execution of that expression.
605
     *
606
     * <p/>
606
     * An XPath object can be instantiated with the following information:
607
     * An XPath object can be instantiated with the following information:
607
     *     - XPath expression to evaluate
608
     * - XPath expression to evaluate
608
     *     - SourceLocator 
609
     * - SourceLocator
609
     *        (reports where an error occurred in the XML source or 
610
     * (reports where an error occurred in the XML source or
610
     *        transformation instructions)
611
     * transformation instructions)
611
     *     - PrefixResolver
612
     * - PrefixResolver
612
     *        (resolve prefixes to namespace URIs)
613
     * (resolve prefixes to namespace URIs)
613
     *     - type
614
     * - type
614
     *        (one of SELECT or MATCH)
615
     * (one of SELECT or MATCH)
615
     *     - ErrorListener
616
     * - ErrorListener
616
     *        (customized error handling)
617
     * (customized error handling)
617
     *
618
     * <p/>
618
     * Execution of the XPath expression represented by an XPath object
619
     * Execution of the XPath expression represented by an XPath object
619
     * is done via method execute which takes the following parameters:
620
     * is done via method execute which takes the following parameters:
620
     *     - XPathContext 
621
     * - XPathContext
621
     *        The execution context
622
     * The execution context
622
     *     - Node contextNode
623
     * - Node contextNode
623
     *        The node that "." expresses
624
     * The node that "." expresses
624
     *     - PrefixResolver namespaceContext
625
     * - PrefixResolver namespaceContext
625
     *        The context in which namespaces in the XPath are supposed to be 
626
     * The context in which namespaces in the XPath are supposed to be
626
     *        expanded.
627
     * expanded.
627
     *
628
     * <p/>
628
     * Given all of this, if no context node is set for the evaluation
629
     * Given all of this, if no context node is set for the evaluation
629
     * of the XPath expression, one must be set so Xalan 
630
     * of the XPath expression, one must be set so Xalan
630
     * can successfully evaluate a JSTL XPath expression.
631
     * can successfully evaluate a JSTL XPath expression.
631
     * (it will not work if the context node is given as a varialbe
632
     * (it will not work if the context node is given as a varialbe
632
     * at the beginning of the expression)
633
     * at the beginning of the expression)
633
     *
634
     *
634
     * @@@ Provide more details...
635
     * @@@ Provide more details...
635
     */
636
     */
636
    protected Node adaptParamsForXalan( JstlVariableContext jvc,  Node n,
637
    protected Node adaptParamsForXalan(JstlVariableContext jvc, Node n,
637
    String xpath ) {
638
                                       String xpath) {
638
        Node boundDocument = null;
639
        Node boundDocument = null;
639
        
640
640
        modifiedXPath = xpath;
641
        modifiedXPath = xpath;
641
        String origXPath = xpath ;
642
        String origXPath = xpath;
642
        boolean whetherOrigXPath = true;
643
        boolean whetherOrigXPath = true;
643
        
644
644
        // If contextNode is not null then  just pass the values to Xalan XPath
645
        // If contextNode is not null then  just pass the values to Xalan XPath
645
        // unless this is an expression that starts off with an xml document 
646
        // unless this is an expression that starts off with an xml document 
646
        if ( n != null && !xpath.startsWith("$") ) {
647
        if (n != null && !xpath.startsWith("$")) {
647
            return n;
648
            return n;
648
        }
649
        }
649
        
650
650
        if (  xpath.startsWith("$")  ) {
651
        if (xpath.startsWith("$")) {
651
            // JSTL uses $scopePrefix:varLocalName/xpath expression
652
            // JSTL uses $scopePrefix:varLocalName/xpath expression
652
653
653
            String varQName=  xpath.substring( xpath.indexOf("$")+1);
654
            String varQName = xpath.substring(xpath.indexOf("$") + 1);
654
            if ( varQName.indexOf("/") > 0 ) {
655
            if (varQName.indexOf("/") > 0) {
655
                varQName = varQName.substring( 0, varQName.indexOf("/"));
656
                varQName = varQName.substring(0, varQName.indexOf("/"));
656
            }
657
            }
657
            String varPrefix =  null;
658
            String varPrefix = null;
658
            String varLocalName =  varQName;
659
            String varLocalName = varQName;
659
            if ( varQName.indexOf( ":") >= 0 ) {
660
            if (varQName.indexOf(":") >= 0) {
660
                varPrefix = varQName.substring( 0, varQName.indexOf(":") );
661
                varPrefix = varQName.substring(0, varQName.indexOf(":"));
661
                varLocalName = varQName.substring( varQName.indexOf(":")+1 );
662
                varLocalName = varQName.substring(varQName.indexOf(":") + 1);
662
            }
663
            }
663
            
664
664
            if ( xpath.indexOf("/") > 0 ) {
665
            if (xpath.indexOf("/") > 0) {
665
                xpath = xpath.substring( xpath.indexOf("/"));
666
                xpath = xpath.substring(xpath.indexOf("/"));
666
            } else  {
667
            } else {
667
                xpath = "/*";
668
                xpath = "/*";
668
                whetherOrigXPath = false; 
669
                whetherOrigXPath = false;
669
            }
670
            }
670
           
671
671
            
672
672
            try {
673
            try {
673
                Object varObject=jvc.getVariableValue( null,varPrefix,
674
                Object varObject = jvc.getVariableValue(null, varPrefix,
674
                varLocalName);
675
                        varLocalName);
675
                //System.out.println( "varObject => : its Class " +varObject +
676
                //System.out.println( "varObject => : its Class " +varObject +
676
                // ":" + varObject.getClass() );
677
                // ":" + varObject.getClass() );
677
                
678
678
                if ( Class.forName("org.w3c.dom.Document").isInstance(
679
                if (Class.forName("org.w3c.dom.Document").isInstance(
679
                varObject ) )  {
680
                        varObject)) {
680
                    //boundDocument = ((Document)varObject).getDocumentElement();
681
                    //boundDocument = ((Document)varObject).getDocumentElement();
681
                    boundDocument = ((Document)varObject);
682
                    boundDocument = ((Document) varObject);
682
                } else {
683
                } else {
683
                    
684
684
                    //System.out.println("Creating a Dummy document to pass " +
685
                    //System.out.println("Creating a Dummy document to pass " +
685
                    // " onto as context node " );
686
                    // " onto as context node " );
686
                    
687
687
                    if ( Class.forName("org.apache.taglibs.standard.tag.common.xml.JSTLNodeList").isInstance( varObject ) ) {
688
                    if (Class.forName("org.apache.taglibs.standard.tag.common.xml.JSTLNodeList").isInstance(varObject)) {
688
                        Document newDocument = getDummyDocument();
689
                        Document newDocument = getDummyDocument();
689
690
690
                        JSTLNodeList jstlNodeList = (JSTLNodeList)varObject;
691
                        JSTLNodeList jstlNodeList = (JSTLNodeList) varObject;
691
                        if   ( jstlNodeList.getLength() == 1 ) { 
692
                        if (jstlNodeList.getLength() == 1) {
692
                            if ( Class.forName("org.w3c.dom.Node").isInstance(
693
                            if (Class.forName("org.w3c.dom.Node").isInstance(
693
                                jstlNodeList.elementAt(0) ) ) { 
694
                                    jstlNodeList.elementAt(0))) {
694
                                Node node = (Node)jstlNodeList.elementAt(0);
695
                                Node node = (Node) jstlNodeList.elementAt(0);
695
                                boundDocument = getDocumentForNode(node);
696
                                boundDocument = getDocumentForNode(node);
696
                                if ( whetherOrigXPath ) {
697
                                if (whetherOrigXPath) {
697
                                    xpath="/*" + xpath;
698
                                    xpath = "/*" + xpath;
698
                                }
699
                                }
699
700
700
                            } else {
701
                            } else {
Lines 709-728 Link Here
709
710
710
                                //p("String value ( xpathwould be this) => " + xpath);
711
                                //p("String value ( xpathwould be this) => " + xpath);
711
                                boundDocument = newDocument;
712
                                boundDocument = newDocument;
712
                            } 
713
                            }
713
                            
714
714
                        } else {
715
                        } else {
715
716
716
                            Element dummyroot = newDocument.getDocumentElement();
717
                            Element dummyroot = newDocument.getDocumentElement();
717
                            for ( int i=0; i< jstlNodeList.getLength(); i++ ) {
718
                            for (int i = 0; i < jstlNodeList.getLength(); i++) {
718
                                Node currNode = (Node)jstlNodeList.item(i);
719
                                Node currNode = (Node) jstlNodeList.item(i);
719
                            
720
720
                                Node importedNode = newDocument.importNode(
721
                                Node importedNode = newDocument.importNode(
721
                                    currNode, true );
722
                                        currNode, true);
722
723
723
                                //printDetails ( newDocument);
724
                                //printDetails ( newDocument);
724
725
725
                                dummyroot.appendChild( importedNode );
726
                                dummyroot.appendChild(importedNode);
726
727
727
                                //p( "Details of the document After importing");
728
                                //p( "Details of the document After importing");
728
                                //printDetails ( newDocument);
729
                                //printDetails ( newDocument);
Lines 733-743 Link Here
733
                            // to change the xpath expression.Hopefully this
734
                            // to change the xpath expression.Hopefully this
734
                            // won't  change the result
735
                            // won't  change the result
735
736
736
                            xpath = "/*" +  xpath;
737
                            xpath = "/*" + xpath;
737
                        }
738
                        }
738
                    } else if ( Class.forName("org.w3c.dom.Node").isInstance(
739
                    } else if (Class.forName("org.w3c.dom.Node").isInstance(
739
                    varObject ) ) {
740
                            varObject)) {
740
                        boundDocument = getDocumentForNode((Node)varObject);
741
                        boundDocument = getDocumentForNode((Node) varObject);
741
                        if (whetherOrigXPath) {
742
                        if (whetherOrigXPath) {
742
                            xpath = "/*" + xpath;
743
                            xpath = "/*" + xpath;
743
                        }
744
                        }
Lines 745-891 Link Here
745
                        boundDocument = getDummyDocument();
746
                        boundDocument = getDummyDocument();
746
                        xpath = origXPath;
747
                        xpath = origXPath;
747
                    }
748
                    }
748
                    
749
749
                    
750
750
                }
751
                }
751
            } catch ( UnresolvableException ue ) {
752
            } catch (UnresolvableException ue) {
752
                // TODO: LOG
753
                // TODO: LOG
753
                System.out.println("Variable Unresolvable :" + ue.getMessage());
754
                System.out.println("Variable Unresolvable :" + ue.getMessage());
754
                ue.printStackTrace();
755
                ue.printStackTrace();
755
            } catch ( ClassNotFoundException cnf ) {
756
            } catch (ClassNotFoundException cnf) {
756
                // Will never happen
757
                // Will never happen
757
            }
758
            }
758
        } else { 
759
        } else {
759
            //System.out.println("Not encountered $ Creating a Dummydocument 2 "+
760
            //System.out.println("Not encountered $ Creating a Dummydocument 2 "+
760
             //   "pass onto as context node " );
761
            //   "pass onto as context node " );
761
            boundDocument = getDummyDocument();
762
            boundDocument = getDummyDocument();
762
        }
763
        }
763
     
764
764
        modifiedXPath = xpath;
765
        modifiedXPath = xpath;
765
        //System.out.println("Modified XPath::boundDocument =>" + modifiedXPath +
766
        //System.out.println("Modified XPath::boundDocument =>" + modifiedXPath +
766
        //    "::" + boundDocument );
767
        //    "::" + boundDocument );
767
         
768
768
        return boundDocument;
769
        return boundDocument;
769
    }
770
    }
770
    
771
771
772
772
    //*********************************************************************
773
    //*********************************************************************
773
    // 
774
    // 
774
    
775
775
    /**
776
    /**
776
     ** @@@ why do we have to pass varVector in the varStack first, and then
777
     * * @@@ why do we have to pass varVector in the varStack first, and then
777
     * to XPath object?
778
     * to XPath object?
778
     */
779
     */
779
    private Vector fillVarStack(JstlVariableContext vs, XPathContext xpathSupport) 
780
    private Vector fillVarStack(JstlVariableContext vs, XPathContext xpathSupport)
780
    throws JspTagException {
781
            throws JspTagException {
781
        org.apache.xpath.VariableStack myvs = xpathSupport.getVarStack();
782
        org.apache.xpath.VariableStack myvs = xpathSupport.getVarStack();
782
        Vector varVector = getVariableQNames();
783
        Vector varVector = getVariableQNames();
783
        for ( int i=0; i<varVector.size(); i++ ) {
784
        for (int i = 0; i < varVector.size(); i++) {
784
          
785
            QName varQName = (QName)varVector.elementAt(i);
786
785
787
            try { 
786
            QName varQName = (QName) varVector.elementAt(i);
788
                XObject variableValue = vs.getVariableOrParam( xpathSupport, varQName );
787
788
            try {
789
                XObject variableValue = vs.getVariableOrParam(xpathSupport, varQName);
789
                //p("&&&&Variable set to => " + variableValue.toString() );
790
                //p("&&&&Variable set to => " + variableValue.toString() );
790
                //p("&&&&Variable type => " + variableValue.getTypeString() );
791
                //p("&&&&Variable type => " + variableValue.getTypeString() );
791
                myvs.setGlobalVariable( i, variableValue );
792
                myvs.setGlobalVariable(i, variableValue);
792
793
793
            } catch ( TransformerException te ) {
794
            } catch (TransformerException te) {
794
                throw new JspTagException(te.toString(), te);
795
                throw new JspTagException(te.toString(), te);
795
            } 
796
            }
796
 
797
797
        }
798
        }
798
        return varVector;
799
        return varVector;
799
    }
800
    }
800
        
801
801
    
802
802
    
803
    
804
    
805
    //*********************************************************************
803
    //*********************************************************************
806
    // Static support for context retrieval from parent <forEach> tag
804
    // Static support for context retrieval from parent <forEach> tag
807
    
805
808
    public static Node getContext(Tag t) throws JspTagException {
806
    public static Node getContext(Tag t) throws JspTagException {
809
        ForEachTag xt =
807
        ForEachTag xt =
810
        (ForEachTag) TagSupport.findAncestorWithClass(
808
                (ForEachTag) TagSupport.findAncestorWithClass(
811
        t, ForEachTag.class);
809
                        t, ForEachTag.class);
812
        if (xt == null)
810
        if (xt == null) {
813
            return null;
811
            return null;
814
        else
812
        } else {
815
            return (xt.getContext());
813
            return (xt.getContext());
814
        }
816
    }
815
    }
817
    
816
818
    //*********************************************************************
817
    //*********************************************************************
819
    // Utility methods
818
    // Utility methods
820
    
819
821
    private static void p(String s) {
820
    private static void p(String s) {
822
        System.out.println("[XPathUtil] " + s);
821
        System.out.println("[XPathUtil] " + s);
823
    }
822
    }
824
    
823
825
    public static void printDetails(Node n) {
824
    public static void printDetails(Node n) {
826
        System.out.println("\n\nDetails of Node = > " + n ) ;
825
        System.out.println("\n\nDetails of Node = > " + n);
827
        System.out.println("Name:Type:Node Value = > " + n.getNodeName() +
826
        System.out.println("Name:Type:Node Value = > " + n.getNodeName() +
828
        ":" + n.getNodeType() + ":" + n.getNodeValue()  ) ;
827
                ":" + n.getNodeType() + ":" + n.getNodeValue());
829
        System.out.println("Namespace URI : Prefix : localName = > " +
828
        System.out.println("Namespace URI : Prefix : localName = > " +
830
        n.getNamespaceURI() + ":" +n.getPrefix() + ":" + n.getLocalName());
829
                n.getNamespaceURI() + ":" + n.getPrefix() + ":" + n.getLocalName());
831
        System.out.println("\n Node has children => " + n.hasChildNodes() );
830
        System.out.println("\n Node has children => " + n.hasChildNodes());
832
        if ( n.hasChildNodes() ) {
831
        if (n.hasChildNodes()) {
833
            NodeList nl = n.getChildNodes();
832
            NodeList nl = n.getChildNodes();
834
            System.out.println("Number of Children => " + nl.getLength() );
833
            System.out.println("Number of Children => " + nl.getLength());
835
            for ( int i=0; i<nl.getLength(); i++ ) {
834
            for (int i = 0; i < nl.getLength(); i++) {
836
                Node childNode = nl.item(i);
835
                Node childNode = nl.item(i);
837
                printDetails( childNode );
836
                printDetails(childNode);
838
            }
837
            }
839
        }
838
        }
840
    }    
839
    }
841
}
840
}
842
841
843
class JSTLNodeList extends Vector implements NodeList   {
842
class JSTLNodeList extends Vector implements NodeList {
844
    
843
845
    Vector nodeVector;
844
    Vector nodeVector;
846
845
847
    public JSTLNodeList ( Vector nodeVector ) {
846
    public JSTLNodeList(Vector nodeVector) {
848
        this.nodeVector = nodeVector;
847
        this.nodeVector = nodeVector;
849
    }
848
    }
850
849
851
    public JSTLNodeList ( NodeList nl ) {
850
    public JSTLNodeList(NodeList nl) {
852
        nodeVector = new Vector();
851
        nodeVector = new Vector();
853
        //System.out.println("[JSTLNodeList] nodelist details");
852
        //System.out.println("[JSTLNodeList] nodelist details");
854
        for ( int i=0; i<nl.getLength(); i++ ) {
853
        for (int i = 0; i < nl.getLength(); i++) {
855
            Node currNode = nl.item(i);
854
            Node currNode = nl.item(i);
856
            //XPathUtil.printDetails ( currNode );
855
            //XPathUtil.printDetails ( currNode );
857
            nodeVector.add(i, nl.item(i) );
856
            nodeVector.add(i, nl.item(i));
858
        }
857
        }
859
    }
858
    }
860
859
861
    public JSTLNodeList ( Node n ) {
860
    public JSTLNodeList(Node n) {
862
        nodeVector = new Vector();
861
        nodeVector = new Vector();
863
        nodeVector.addElement( n );
862
        nodeVector.addElement(n);
864
    }
863
    }
865
        
866
864
867
    public Node item ( int index ) {
865
868
        return (Node)nodeVector.elementAt( index );
866
    public Node item(int index) {
867
        return (Node) nodeVector.elementAt(index);
869
    }
868
    }
870
869
871
    @Override
870
    @Override
872
    public Object elementAt ( int index ) {
871
    public Object elementAt(int index) {
873
        return nodeVector.elementAt( index );
872
        return nodeVector.elementAt(index);
874
    }
873
    }
875
874
876
    @Override
875
    @Override
877
    public Object get ( int index ) {
876
    public Object get(int index) {
878
        return nodeVector.get( index );
877
        return nodeVector.get(index);
879
    }
878
    }
880
879
881
    public int getLength (  ) {
880
    public int getLength() {
882
        return nodeVector.size( );
881
        return nodeVector.size();
883
    }
882
    }
884
883
885
    @Override
884
    @Override
886
    public int size (  ) {
885
    public int size() {
887
        //System.out.println("JSTL node list size => " + nodeVector.size() );
886
        //System.out.println("JSTL node list size => " + nodeVector.size() );
888
        return nodeVector.size( );
887
        return nodeVector.size();
889
    }
888
    }
890
889
891
    // Can implement other Vector methods to redirect those methods to 
890
    // Can implement other Vector methods to redirect those methods to 
(-)src/main/java/org/apache/taglibs/standard/tag/common/xml/ForEachTag.java (-20 / +23 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tag.common.xml;
18
package org.apache.taglibs.standard.tag.common.xml;
19
19
Lines 27-44 Link Here
27
/**
27
/**
28
 * <p>Support for the XML library's &lt;forEach&gt; tag.</p>
28
 * <p>Support for the XML library's &lt;forEach&gt; tag.</p>
29
 *
29
 *
30
 * @author Shawn Bayern
30
 * @see javax.servlet.jsp.jstl.core.LoopTagSupport
31
 * @see javax.servlet.jsp.jstl.core.LoopTagSupport
31
 * @author Shawn Bayern
32
 */
32
 */
33
public class ForEachTag extends LoopTagSupport {
33
public class ForEachTag extends LoopTagSupport {
34
34
35
    //*********************************************************************
35
    //*********************************************************************
36
    // Private state
36
    // Private state
37
37
38
    private String select;				// tag attribute
38
    private String select;                // tag attribute
39
    private List nodes;					// XPath result
39
    private List nodes;                    // XPath result
40
    private int nodesIndex;				// current index
40
    private int nodesIndex;                // current index
41
    private org.w3c.dom.Node current;			// current node
41
    private org.w3c.dom.Node current;            // current node
42
42
43
    //*********************************************************************
43
    //*********************************************************************
44
    // Iteration control methods
44
    // Iteration control methods
Lines 59-69 Link Here
59
59
60
    @Override
60
    @Override
61
    protected Object next() throws JspTagException {
61
    protected Object next() throws JspTagException {
62
	Object o = nodes.get(nodesIndex++);
62
        Object o = nodes.get(nodesIndex++);
63
	if (!(o instanceof org.w3c.dom.Node))
63
        if (!(o instanceof org.w3c.dom.Node)) {
64
	    throw new JspTagException(
64
            throw new JspTagException(
65
		Resources.getMessage("FOREACH_NOT_NODESET"));
65
                    Resources.getMessage("FOREACH_NOT_NODESET"));
66
	current = (org.w3c.dom.Node) o;
66
        }
67
        current = (org.w3c.dom.Node) o;
67
        return current;
68
        return current;
68
    }
69
    }
69
70
Lines 72-80 Link Here
72
    // Tag logic and lifecycle management
73
    // Tag logic and lifecycle management
73
74
74
    // Releases any resources we may have (or inherit)
75
    // Releases any resources we may have (or inherit)
76
75
    @Override
77
    @Override
76
    public void release() {
78
    public void release() {
77
	init();
79
        init();
78
        super.release();
80
        super.release();
79
    }
81
    }
80
82
Lines 83-89 Link Here
83
    // Attribute accessors
85
    // Attribute accessors
84
86
85
    public void setSelect(String select) {
87
    public void setSelect(String select) {
86
	this.select = select;
88
        this.select = select;
87
    }
89
    }
88
90
89
    public void setBegin(int begin) throws JspTagException {
91
    public void setBegin(int begin) throws JspTagException {
Lines 103-115 Link Here
103
        this.step = step;
105
        this.step = step;
104
        validateStep();
106
        validateStep();
105
    }
107
    }
106
    
108
107
    //*********************************************************************
109
    //*********************************************************************
108
    // Public methods for subtags
110
    // Public methods for subtags
109
111
110
    /* Retrieves the current context. */
112
    /* Retrieves the current context. */
113
111
    public org.w3c.dom.Node getContext() throws JspTagException {
114
    public org.w3c.dom.Node getContext() throws JspTagException {
112
	// expose the current node as the context
115
        // expose the current node as the context
113
        return current;
116
        return current;
114
    }
117
    }
115
118
Lines 118-127 Link Here
118
    // Private utility methods
121
    // Private utility methods
119
122
120
    private void init() {
123
    private void init() {
121
	select = null;
124
        select = null;
122
	nodes = null;
125
        nodes = null;
123
	nodesIndex = 0;
126
        nodesIndex = 0;
124
	current = null;
127
        current = null;
125
    }	
128
    }
126
}
129
}
127
130
(-)src/main/java/org/apache/taglibs/standard/tag/common/xml/ParseSupport.java (-130 / +165 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tag.common.xml;
18
package org.apache.taglibs.standard.tag.common.xml;
19
19
Lines 60-74 Link Here
60
60
61
    protected Object xml;                          // 'xml' attribute
61
    protected Object xml;                          // 'xml' attribute
62
    protected String systemId;                     // 'systemId' attribute
62
    protected String systemId;                     // 'systemId' attribute
63
    protected XMLFilter filter;			   // 'filter' attribute
63
    protected XMLFilter filter;               // 'filter' attribute
64
64
65
    //*********************************************************************
65
    //*********************************************************************
66
    // Private state
66
    // Private state
67
67
68
    private String var;                            // 'var' attribute
68
    private String var;                            // 'var' attribute
69
    private String varDom;			   // 'varDom' attribute
69
    private String varDom;               // 'varDom' attribute
70
    private int scope;				   // processed 'scope' attr
70
    private int scope;                   // processed 'scope' attr
71
    private int scopeDom;			   // processed 'scopeDom' attr
71
    private int scopeDom;               // processed 'scopeDom' attr
72
72
73
    // state in support of XML parsing...
73
    // state in support of XML parsing...
74
    private DocumentBuilderFactory dbf;
74
    private DocumentBuilderFactory dbf;
Lines 81-101 Link Here
81
    // Constructor and initialization
81
    // Constructor and initialization
82
82
83
    public ParseSupport() {
83
    public ParseSupport() {
84
	super();
84
        super();
85
	init();
85
        init();
86
    }
86
    }
87
87
88
    private void init() {
88
    private void init() {
89
	var = varDom = null;
89
        var = varDom = null;
90
	xml = null;
90
        xml = null;
91
	systemId = null;
91
        systemId = null;
92
	filter = null;
92
        filter = null;
93
	dbf = null;
93
        dbf = null;
94
	db = null;
94
        db = null;
95
	tf = null;
95
        tf = null;
96
	th = null;
96
        th = null;
97
	scope = PageContext.PAGE_SCOPE;
97
        scope = PageContext.PAGE_SCOPE;
98
	scopeDom = PageContext.PAGE_SCOPE;
98
        scopeDom = PageContext.PAGE_SCOPE;
99
    }
99
    }
100
100
101
101
Lines 103-189 Link Here
103
    // Tag logic
103
    // Tag logic
104
104
105
    // parse 'source' or body, storing result in 'var'
105
    // parse 'source' or body, storing result in 'var'
106
106
    @Override
107
    @Override
107
    public int doEndTag() throws JspException {
108
    public int doEndTag() throws JspException {
108
      try {
109
        try {
109
	
110
	// set up our DocumentBuilder
111
        if (dbf == null) {
112
            dbf = DocumentBuilderFactory.newInstance();
113
            dbf.setNamespaceAware(true);
114
            dbf.setValidating(false);
115
        }
116
        db = dbf.newDocumentBuilder();
117
110
118
	// if we've gotten a filter, set up a transformer to support it
111
            // set up our DocumentBuilder
119
	if (filter != null) {
112
            if (dbf == null) {
120
            if (tf == null)
113
                dbf = DocumentBuilderFactory.newInstance();
121
                tf = TransformerFactory.newInstance();
114
                dbf.setNamespaceAware(true);
122
            if (!tf.getFeature(SAXTransformerFactory.FEATURE))
115
                dbf.setValidating(false);
116
            }
117
            db = dbf.newDocumentBuilder();
118
119
            // if we've gotten a filter, set up a transformer to support it
120
            if (filter != null) {
121
                if (tf == null) {
122
                    tf = TransformerFactory.newInstance();
123
                }
124
                if (!tf.getFeature(SAXTransformerFactory.FEATURE)) {
125
                    throw new JspTagException(
126
                            Resources.getMessage("PARSE_NO_SAXTRANSFORMER"));
127
                }
128
                SAXTransformerFactory stf = (SAXTransformerFactory) tf;
129
                th = stf.newTransformerHandler();
130
            }
131
132
            // produce a Document by parsing whatever the attributes tell us to use
133
            Document d;
134
            Object xmlText = this.xml;
135
            if (xmlText == null) {
136
                // if the attribute was specified, use the body as 'xml'
137
                if (bodyContent != null && bodyContent.getString() != null) {
138
                    xmlText = bodyContent.getString().trim();
139
                } else {
140
                    xmlText = "";
141
                }
142
            }
143
            if (xmlText instanceof String) {
144
                d = parseStringWithFilter((String) xmlText, filter);
145
            } else if (xmlText instanceof Reader) {
146
                d = parseReaderWithFilter((Reader) xmlText, filter);
147
            } else {
123
                throw new JspTagException(
148
                throw new JspTagException(
124
		    Resources.getMessage("PARSE_NO_SAXTRANSFORMER"));
149
                        Resources.getMessage("PARSE_INVALID_SOURCE"));
125
            SAXTransformerFactory stf = (SAXTransformerFactory) tf;
150
            }
126
            th = stf.newTransformerHandler();
127
	}
128
151
129
	// produce a Document by parsing whatever the attributes tell us to use
152
            // we've got a Document object; store it out as appropriate
130
	Document d;
153
            // (let any exclusivity or other constraints be enforced by TEI/TLV)
131
	Object xmlText = this.xml;
154
            if (var != null) {
132
	if (xmlText == null) {
155
                pageContext.setAttribute(var, d, scope);
133
	    // if the attribute was specified, use the body as 'xml'
156
            }
134
	    if (bodyContent != null && bodyContent.getString() != null)
157
            if (varDom != null) {
135
		xmlText = bodyContent.getString().trim();
158
                pageContext.setAttribute(varDom, d, scopeDom);
136
	    else
159
            }
137
		xmlText = "";
138
	}
139
	if (xmlText instanceof String)
140
	    d = parseStringWithFilter((String) xmlText, filter);
141
	else if (xmlText instanceof Reader)
142
	    d = parseReaderWithFilter((Reader) xmlText, filter);
143
	else
144
	    throw new JspTagException(
145
	        Resources.getMessage("PARSE_INVALID_SOURCE"));
146
160
147
	// we've got a Document object; store it out as appropriate
161
            return EVAL_PAGE;
148
	// (let any exclusivity or other constraints be enforced by TEI/TLV)
162
        } catch (SAXException ex) {
149
	if (var != null)
163
            throw new JspException(ex);
150
	    pageContext.setAttribute(var, d, scope);
164
        } catch (IOException ex) {
151
	if (varDom != null)
165
            throw new JspException(ex);
152
	    pageContext.setAttribute(varDom, d, scopeDom);
166
        } catch (ParserConfigurationException ex) {
153
167
            throw new JspException(ex);
154
	return EVAL_PAGE;
168
        } catch (TransformerConfigurationException ex) {
155
      } catch (SAXException ex) {
169
            throw new JspException(ex);
156
	throw new JspException(ex);
170
        }
157
      } catch (IOException ex) {
158
	throw new JspException(ex);
159
      } catch (ParserConfigurationException ex) {
160
	throw new JspException(ex);
161
      } catch (TransformerConfigurationException ex) {
162
	throw new JspException(ex);
163
      }
164
    }
171
    }
165
172
166
    // Releases any resources we may have (or inherit)
173
    // Releases any resources we may have (or inherit)
174
167
    @Override
175
    @Override
168
    public void release() {
176
    public void release() {
169
	init();
177
        init();
170
    }
178
    }
171
179
172
180
173
    //*********************************************************************
181
    //*********************************************************************
174
    // Private utility methods
182
    // Private utility methods
175
183
176
    /** Parses the given InputSource after, applying the given XMLFilter. */
184
    /**
185
     * Parses the given InputSource after, applying the given XMLFilter.
186
     */
177
    private Document parseInputSourceWithFilter(InputSource s, XMLFilter f)
187
    private Document parseInputSourceWithFilter(InputSource s, XMLFilter f)
178
            throws SAXException, IOException {
188
            throws SAXException, IOException {
179
	if (f != null) {
189
        if (f != null) {
180
            // prepare an output Document
190
            // prepare an output Document
181
            Document o = db.newDocument();
191
            Document o = db.newDocument();
182
192
183
            // use TrAX to adapt SAX events to a Document object
193
            // use TrAX to adapt SAX events to a Document object
184
            th.setResult(new DOMResult(o));
194
            th.setResult(new DOMResult(o));
185
            XMLReader xr = XMLReaderFactory.createXMLReader();
195
            XMLReader xr = XMLReaderFactory.createXMLReader();
186
	    xr.setEntityResolver(new JstlEntityResolver(pageContext));
196
            xr.setEntityResolver(new JstlEntityResolver(pageContext));
187
            //   (note that we overwrite the filter's parent.  this seems
197
            //   (note that we overwrite the filter's parent.  this seems
188
            //    to be expected usage.  we could cache and reset the old
198
            //    to be expected usage.  we could cache and reset the old
189
            //    parent, but you can't setParent(null), so this wouldn't
199
            //    parent, but you can't setParent(null), so this wouldn't
Lines 192-298 Link Here
192
            f.setContentHandler(th);
202
            f.setContentHandler(th);
193
            f.parse(s);
203
            f.parse(s);
194
            return o;
204
            return o;
195
	} else
205
        } else {
196
	    return parseInputSource(s);	
206
            return parseInputSource(s);
207
        }
197
    }
208
    }
198
209
199
    /** Parses the given Reader after applying the given XMLFilter. */
210
    /**
211
     * Parses the given Reader after applying the given XMLFilter.
212
     */
200
    private Document parseReaderWithFilter(Reader r, XMLFilter f)
213
    private Document parseReaderWithFilter(Reader r, XMLFilter f)
201
            throws SAXException, IOException {
214
            throws SAXException, IOException {
202
	return parseInputSourceWithFilter(new InputSource(r), f);
215
        return parseInputSourceWithFilter(new InputSource(r), f);
203
    }
216
    }
204
217
205
    /** Parses the given String after applying the given XMLFilter. */
218
    /**
219
     * Parses the given String after applying the given XMLFilter.
220
     */
206
    private Document parseStringWithFilter(String s, XMLFilter f)
221
    private Document parseStringWithFilter(String s, XMLFilter f)
207
            throws SAXException, IOException {
222
            throws SAXException, IOException {
208
        StringReader r = new StringReader(s);
223
        StringReader r = new StringReader(s);
209
        return parseReaderWithFilter(r, f);
224
        return parseReaderWithFilter(r, f);
210
    }
225
    }
211
226
212
    /** Parses the given Reader after applying the given XMLFilter. */
227
    /**
228
     * Parses the given Reader after applying the given XMLFilter.
229
     */
213
    private Document parseURLWithFilter(String url, XMLFilter f)
230
    private Document parseURLWithFilter(String url, XMLFilter f)
214
            throws SAXException, IOException {
231
            throws SAXException, IOException {
215
	return parseInputSourceWithFilter(new InputSource(url), f);
232
        return parseInputSourceWithFilter(new InputSource(url), f);
216
    }
233
    }
217
234
218
    /** Parses the given InputSource into a Document. */
235
    /**
236
     * Parses the given InputSource into a Document.
237
     */
219
    private Document parseInputSource(InputSource s)
238
    private Document parseInputSource(InputSource s)
220
	    throws SAXException, IOException {
239
            throws SAXException, IOException {
221
	db.setEntityResolver(new JstlEntityResolver(pageContext));
240
        db.setEntityResolver(new JstlEntityResolver(pageContext));
222
241
223
        // normalize URIs so they can be processed consistently by resolver
242
        // normalize URIs so they can be processed consistently by resolver
224
        if (systemId == null)
243
        if (systemId == null) {
225
            s.setSystemId("jstl:");
244
            s.setSystemId("jstl:");
226
	else if (ImportSupport.isAbsoluteUrl(systemId))
245
        } else if (ImportSupport.isAbsoluteUrl(systemId)) {
227
            s.setSystemId(systemId);
246
            s.setSystemId(systemId);
228
        else
247
        } else {
229
            s.setSystemId("jstl:" + systemId);
248
            s.setSystemId("jstl:" + systemId);
230
	return db.parse(s);
249
        }
250
        return db.parse(s);
231
    }
251
    }
232
252
233
    /** Parses the given Reader into a Document. */
253
    /**
254
     * Parses the given Reader into a Document.
255
     */
234
    private Document parseReader(Reader r) throws SAXException, IOException {
256
    private Document parseReader(Reader r) throws SAXException, IOException {
235
        return parseInputSource(new InputSource(r));
257
        return parseInputSource(new InputSource(r));
236
    }
258
    }
237
259
238
    /** Parses the given String into a Document. */
260
    /**
261
     * Parses the given String into a Document.
262
     */
239
    private Document parseString(String s) throws SAXException, IOException {
263
    private Document parseString(String s) throws SAXException, IOException {
240
        StringReader r = new StringReader(s);
264
        StringReader r = new StringReader(s);
241
        return parseReader(r);
265
        return parseReader(r);
242
    }
266
    }
243
267
244
    /** Parses the URL (passed as a String) into a Document. */
268
    /**
269
     * Parses the URL (passed as a String) into a Document.
270
     */
245
    private Document parseURL(String url) throws SAXException, IOException {
271
    private Document parseURL(String url) throws SAXException, IOException {
246
	return parseInputSource(new InputSource(url));
272
        return parseInputSource(new InputSource(url));
247
    }
273
    }
248
274
249
    //*********************************************************************
275
    //*********************************************************************
250
    // JSTL-specific EntityResolver class
276
    // JSTL-specific EntityResolver class
251
277
252
    /** Lets us resolve relative external entities. */
278
    /**
279
     * Lets us resolve relative external entities.
280
     */
253
    public static class JstlEntityResolver implements EntityResolver {
281
    public static class JstlEntityResolver implements EntityResolver {
254
	private final PageContext ctx;
282
        private final PageContext ctx;
283
255
        public JstlEntityResolver(PageContext ctx) {
284
        public JstlEntityResolver(PageContext ctx) {
256
            this.ctx = ctx;
285
            this.ctx = ctx;
257
        }
286
        }
287
258
        public InputSource resolveEntity(String publicId, String systemId)
288
        public InputSource resolveEntity(String publicId, String systemId)
259
	        throws FileNotFoundException {
289
                throws FileNotFoundException {
260
290
261
	    // pass if we don't have a systemId
291
            // pass if we don't have a systemId
262
	    if (systemId == null)
292
            if (systemId == null) {
263
		return null;
293
                return null;
294
            }
264
295
265
	    // strip leading "jstl:" off URL if applicable
296
            // strip leading "jstl:" off URL if applicable
266
	    if (systemId.startsWith("jstl:"))
297
            if (systemId.startsWith("jstl:")) {
267
		systemId = systemId.substring(5);
298
                systemId = systemId.substring(5);
299
            }
268
300
269
	    // we're only concerned with relative URLs
301
            // we're only concerned with relative URLs
270
	    if (ImportSupport.isAbsoluteUrl(systemId))
302
            if (ImportSupport.isAbsoluteUrl(systemId)) {
271
		return null;
303
                return null;
304
            }
272
305
273
	    // for relative URLs, load and wrap the resource.
306
            // for relative URLs, load and wrap the resource.
274
	    // don't bother checking for 'null' since we specifically want
307
            // don't bother checking for 'null' since we specifically want
275
	    // the parser to fail if the resource doesn't exist
308
            // the parser to fail if the resource doesn't exist
276
	    InputStream s;
309
            InputStream s;
277
	    if (systemId.startsWith("/")) {
310
            if (systemId.startsWith("/")) {
278
	        s = ctx.getServletContext().getResourceAsStream(systemId);
311
                s = ctx.getServletContext().getResourceAsStream(systemId);
279
	        if (s == null)
312
                if (s == null) {
280
		    throw new FileNotFoundException(
313
                    throw new FileNotFoundException(
281
			Resources.getMessage("UNABLE_TO_RESOLVE_ENTITY",
314
                            Resources.getMessage("UNABLE_TO_RESOLVE_ENTITY",
282
			 systemId));
315
                                    systemId));
283
	    } else {
316
                }
284
		String pagePath =
317
            } else {
285
		    ((HttpServletRequest) ctx.getRequest()).getServletPath();
318
                String pagePath =
286
		String basePath =
319
                        ((HttpServletRequest) ctx.getRequest()).getServletPath();
287
		    pagePath.substring(0, pagePath.lastIndexOf("/"));
320
                String basePath =
288
		s = ctx.getServletContext().getResourceAsStream(
321
                        pagePath.substring(0, pagePath.lastIndexOf("/"));
289
		      basePath + "/" + systemId);
322
                s = ctx.getServletContext().getResourceAsStream(
290
	        if (s == null)
323
                        basePath + "/" + systemId);
291
		    throw new FileNotFoundException(
324
                if (s == null) {
292
			Resources.getMessage("UNABLE_TO_RESOLVE_ENTITY",
325
                    throw new FileNotFoundException(
293
			 systemId));
326
                            Resources.getMessage("UNABLE_TO_RESOLVE_ENTITY",
294
	    }
327
                                    systemId));
295
	    return new InputSource(s);
328
                }
329
            }
330
            return new InputSource(s);
296
        }
331
        }
297
    }
332
    }
298
333
Lines 300-317 Link Here
300
    // Tag attributes
335
    // Tag attributes
301
336
302
    public void setVar(String var) {
337
    public void setVar(String var) {
303
	this.var = var;
338
        this.var = var;
304
    }
339
    }
305
340
306
    public void setVarDom(String varDom) {
341
    public void setVarDom(String varDom) {
307
	this.varDom = varDom;
342
        this.varDom = varDom;
308
    }
343
    }
309
344
310
    public void setScope(String scope) {
345
    public void setScope(String scope) {
311
	this.scope = Util.getScope(scope);
346
        this.scope = Util.getScope(scope);
312
    }
347
    }
313
348
314
    public void setScopeDom(String scopeDom) {
349
    public void setScopeDom(String scopeDom) {
315
	this.scopeDom = Util.getScope(scopeDom);
350
        this.scopeDom = Util.getScope(scopeDom);
316
    }
351
    }
317
}
352
}
(-)src/main/java/org/apache/taglibs/standard/tag/common/xml/SetTag.java (-11 / +15 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tag.common.xml;
18
package org.apache.taglibs.standard.tag.common.xml;
19
19
Lines 37-43 Link Here
37
37
38
    private String select;                    // tag attribute
38
    private String select;                    // tag attribute
39
    private String var;                       // tag attribute
39
    private String var;                       // tag attribute
40
    private int scope;			      // processed tag attribute
40
    private int scope;                  // processed tag attribute
41
41
42
    //*********************************************************************
42
    //*********************************************************************
43
    // Construction and initialization
43
    // Construction and initialization
Lines 53-61 Link Here
53
    }
53
    }
54
54
55
    // resets local state
55
    // resets local state
56
56
    private void init() {
57
    private void init() {
57
	var = null;
58
        var = null;
58
	select = null;
59
        select = null;
59
        scope = PageContext.PAGE_SCOPE;
60
        scope = PageContext.PAGE_SCOPE;
60
    }
61
    }
61
62
Lines 64-91 Link Here
64
    // Tag logic
65
    // Tag logic
65
66
66
    // applies XPath expression from 'select' and stores the result in 'var'
67
    // applies XPath expression from 'select' and stores the result in 'var'
68
67
    @Override
69
    @Override
68
    public int doStartTag() throws JspException {
70
    public int doStartTag() throws JspException {
69
        // process the query
71
        // process the query
70
        XPathUtil xu = new XPathUtil(pageContext);
72
        XPathUtil xu = new XPathUtil(pageContext);
71
        List result =
73
        List result =
72
        xu.selectNodes(XPathUtil.getContext(this), select);
74
                xu.selectNodes(XPathUtil.getContext(this), select);
73
        Object ret = result;
75
        Object ret = result;
74
        
76
75
        // unwrap primitive types if that's what we received
77
        // unwrap primitive types if that's what we received
76
        if (result.size() == 1) {
78
        if (result.size() == 1) {
77
            Object o = result.get(0);
79
            Object o = result.get(0);
78
            if (o instanceof String || o instanceof Boolean
80
            if (o instanceof String || o instanceof Boolean
79
            || o instanceof Number)
81
                    || o instanceof Number) {
80
                ret = o;
82
                ret = o;
83
            }
81
        }
84
        }
82
        
85
83
        // expose the final result
86
        // expose the final result
84
        pageContext.setAttribute(var, ret, scope);
87
        pageContext.setAttribute(var, ret, scope);
85
        return SKIP_BODY;
88
        return SKIP_BODY;
86
    }
89
    }
87
90
88
    // Releases any resources we may have (or inherit)
91
    // Releases any resources we may have (or inherit)
92
89
    @Override
93
    @Override
90
    public void release() {
94
    public void release() {
91
        super.release();
95
        super.release();
Lines 97-110 Link Here
97
    // Attribute accessors
101
    // Attribute accessors
98
102
99
    public void setSelect(String select) {
103
    public void setSelect(String select) {
100
	this.select = select;
104
        this.select = select;
101
    }
105
    }
102
106
103
    public void setVar(String var) {
107
    public void setVar(String var) {
104
	this.var = var;
108
        this.var = var;
105
    }
109
    }
106
110
107
    public void setScope(String scope) {
111
    public void setScope(String scope) {
108
	this.scope = Util.getScope(scope);
112
        this.scope = Util.getScope(scope);
109
    }
113
    }
110
}
114
}
(-)src/main/java/org/apache/taglibs/standard/tag/common/xml/TransformSupport.java (-11 / +20 lines)
Lines 23-28 Link Here
23
import java.io.StringReader;
23
import java.io.StringReader;
24
import java.io.Writer;
24
import java.io.Writer;
25
import java.util.List;
25
import java.util.List;
26
26
import javax.servlet.http.HttpServletRequest;
27
import javax.servlet.http.HttpServletRequest;
27
import javax.servlet.jsp.JspException;
28
import javax.servlet.jsp.JspException;
28
import javax.servlet.jsp.JspTagException;
29
import javax.servlet.jsp.JspTagException;
Lines 130-138 Link Here
130
131
131
            // we can assume at most one of 'var' or 'result' is specified
132
            // we can assume at most one of 'var' or 'result' is specified
132
            if (result != null)
133
            if (result != null)
133
                // we can write directly to the Result
134
            // we can write directly to the Result
135
            {
134
                t.transform(source, result);
136
                t.transform(source, result);
135
            else if (var != null) {
137
            } else if (var != null) {
136
                // we need a Document
138
                // we need a Document
137
                Document d = db.newDocument();
139
                Document d = db.newDocument();
138
                Result doc = new DOMResult(d);
140
                Result doc = new DOMResult(d);
Lines 183-194 Link Here
183
     * the current directory in the filesystem.
185
     * the current directory in the filesystem.
184
     */
186
     */
185
    private static String wrapSystemId(String systemId) {
187
    private static String wrapSystemId(String systemId) {
186
        if (systemId == null)
188
        if (systemId == null) {
187
            return "jstl:";
189
            return "jstl:";
188
        else if (ImportSupport.isAbsoluteUrl(systemId))
190
        } else if (ImportSupport.isAbsoluteUrl(systemId)) {
189
            return systemId;
191
            return systemId;
190
        else
192
        } else {
191
            return ("jstl:" + systemId);
193
            return ("jstl:" + systemId);
194
        }
192
    }
195
    }
193
196
194
    /**
197
    /**
Lines 271-276 Link Here
271
274
272
    /**
275
    /**
273
     * Return the Source for a document specified as body content.
276
     * Return the Source for a document specified as body content.
277
     *
274
     * @return the document Source
278
     * @return the document Source
275
     * @throws JspTagException if there is a problem with the body content
279
     * @throws JspTagException if there is a problem with the body content
276
     */
280
     */
Lines 373-380 Link Here
373
                throws TransformerException {
377
                throws TransformerException {
374
378
375
            // pass if we don't have a systemId
379
            // pass if we don't have a systemId
376
            if (href == null)
380
            if (href == null) {
377
                return null;
381
                return null;
382
            }
378
383
379
            // remove "jstl" marker from 'base'
384
            // remove "jstl" marker from 'base'
380
            // NOTE: how 'base' is determined varies among different Xalan
385
            // NOTE: how 'base' is determined varies among different Xalan
Lines 386-399 Link Here
386
391
387
            // we're only concerned with relative URLs
392
            // we're only concerned with relative URLs
388
            if (ImportSupport.isAbsoluteUrl(href)
393
            if (ImportSupport.isAbsoluteUrl(href)
389
                    || (base != null && ImportSupport.isAbsoluteUrl(base)))
394
                    || (base != null && ImportSupport.isAbsoluteUrl(base))) {
390
                return null;
395
                return null;
396
            }
391
397
392
            // base is relative; remove everything after trailing '/'
398
            // base is relative; remove everything after trailing '/'
393
            if (base == null || base.lastIndexOf("/") == -1)
399
            if (base == null || base.lastIndexOf("/") == -1) {
394
                base = "";
400
                base = "";
395
            else
401
            } else {
396
                base = base.substring(0, base.lastIndexOf("/") + 1);
402
                base = base.substring(0, base.lastIndexOf("/") + 1);
403
            }
397
404
398
            // concatenate to produce the real URL we're interested in
405
            // concatenate to produce the real URL we're interested in
399
            String target = base + href;
406
            String target = base + href;
Lines 404-413 Link Here
404
            InputStream s;
411
            InputStream s;
405
            if (target.startsWith("/")) {
412
            if (target.startsWith("/")) {
406
                s = ctx.getServletContext().getResourceAsStream(target);
413
                s = ctx.getServletContext().getResourceAsStream(target);
407
                if (s == null)
414
                if (s == null) {
408
                    throw new TransformerException(
415
                    throw new TransformerException(
409
                            Resources.getMessage("UNABLE_TO_RESOLVE_ENTITY",
416
                            Resources.getMessage("UNABLE_TO_RESOLVE_ENTITY",
410
                                    href));
417
                                    href));
418
                }
411
            } else {
419
            } else {
412
                String pagePath =
420
                String pagePath =
413
                        ((HttpServletRequest) ctx.getRequest()).getServletPath();
421
                        ((HttpServletRequest) ctx.getRequest()).getServletPath();
Lines 415-424 Link Here
415
                        pagePath.substring(0, pagePath.lastIndexOf("/"));
423
                        pagePath.substring(0, pagePath.lastIndexOf("/"));
416
                s = ctx.getServletContext().getResourceAsStream(
424
                s = ctx.getServletContext().getResourceAsStream(
417
                        basePath + "/" + target);
425
                        basePath + "/" + target);
418
                if (s == null)
426
                if (s == null) {
419
                    throw new TransformerException(
427
                    throw new TransformerException(
420
                            Resources.getMessage("UNABLE_TO_RESOLVE_ENTITY",
428
                            Resources.getMessage("UNABLE_TO_RESOLVE_ENTITY",
421
                                    href));
429
                                    href));
430
                }
422
            }
431
            }
423
            return new StreamSource(s);
432
            return new StreamSource(s);
424
        }
433
        }
(-)src/main/java/org/apache/taglibs/standard/tag/common/xml/IfTag.java (-1 / +4 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tag.common.xml;
18
package org.apache.taglibs.standard.tag.common.xml;
19
19
Lines 32-43 Link Here
32
    // Constructor and lifecycle management
32
    // Constructor and lifecycle management
33
33
34
    // initialize inherited and local state
34
    // initialize inherited and local state
35
35
    public IfTag() {
36
    public IfTag() {
36
        super();
37
        super();
37
        init();
38
        init();
38
    }
39
    }
39
40
40
    // Releases any resources we may have (or inherit)
41
    // Releases any resources we may have (or inherit)
42
41
    @Override
43
    @Override
42
    public void release() {
44
    public void release() {
43
        super.release();
45
        super.release();
Lines 73-78 Link Here
73
    // Private utility methods
75
    // Private utility methods
74
76
75
    // resets internal state
77
    // resets internal state
78
76
    private void init() {
79
    private void init() {
77
        select = null;
80
        select = null;
78
    }
81
    }
(-)src/main/java/org/apache/taglibs/standard/tag/common/xml/ExprSupport.java (-8 / +11 lines)
Lines 13-31 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tag.common.xml;
18
package org.apache.taglibs.standard.tag.common.xml;
19
19
20
import org.apache.taglibs.standard.util.EscapeXML;
21
22
import javax.servlet.jsp.JspException;
20
import javax.servlet.jsp.JspException;
23
import javax.servlet.jsp.JspTagException;
21
import javax.servlet.jsp.JspTagException;
24
import javax.servlet.jsp.tagext.TagSupport;
22
import javax.servlet.jsp.tagext.TagSupport;
25
23
24
import org.apache.taglibs.standard.util.EscapeXML;
25
26
/**
26
/**
27
 * <p>Tag handler for &lt;out&gt; in JSTL's XML library.</p>
27
 * <p>Tag handler for &lt;out&gt; in JSTL's XML library.</p>
28
 *
28
 * <p/>
29
 * TODO: should we rename this to OutSupport to match the tag name?
29
 * TODO: should we rename this to OutSupport to match the tag name?
30
 *
30
 *
31
 * @author Shawn Bayern
31
 * @author Shawn Bayern
Lines 37-43 Link Here
37
    // Internal state
37
    // Internal state
38
38
39
    private String select;                       // tag attribute
39
    private String select;                       // tag attribute
40
    protected boolean escapeXml;		 // tag attribute
40
    protected boolean escapeXml;         // tag attribute
41
41
42
    //*********************************************************************
42
    //*********************************************************************
43
    // Construction and initialization
43
    // Construction and initialization
Lines 53-60 Link Here
53
    }
53
    }
54
54
55
    // resets local state
55
    // resets local state
56
56
    private void init() {
57
    private void init() {
57
	select = null;
58
        select = null;
58
        escapeXml = true;
59
        escapeXml = true;
59
    }
60
    }
60
61
Lines 63-81 Link Here
63
    // Tag logic
64
    // Tag logic
64
65
65
    // applies XPath expression from 'select' and prints the result
66
    // applies XPath expression from 'select' and prints the result
67
66
    @Override
68
    @Override
67
    public int doStartTag() throws JspException {
69
    public int doStartTag() throws JspException {
68
        try {
70
        try {
69
            XPathUtil xu = new XPathUtil(pageContext);
71
            XPathUtil xu = new XPathUtil(pageContext);
70
            String result = xu.valueOf(XPathUtil.getContext(this), select);
72
            String result = xu.valueOf(XPathUtil.getContext(this), select);
71
            EscapeXML.emit(result, escapeXml, pageContext.getOut());
73
            EscapeXML.emit(result, escapeXml, pageContext.getOut());
72
    	    return SKIP_BODY;
74
            return SKIP_BODY;
73
        } catch (java.io.IOException ex) {
75
        } catch (java.io.IOException ex) {
74
            throw new JspTagException(ex.toString(), ex);
76
            throw new JspTagException(ex.toString(), ex);
75
        }
77
        }
76
    }
78
    }
77
79
78
    // Releases any resources we may have (or inherit)
80
    // Releases any resources we may have (or inherit)
81
79
    @Override
82
    @Override
80
    public void release() {
83
    public void release() {
81
        super.release();
84
        super.release();
Lines 87-92 Link Here
87
    // Attribute accessors
90
    // Attribute accessors
88
91
89
    public void setSelect(String select) {
92
    public void setSelect(String select) {
90
	this.select = select;
93
        this.select = select;
91
    }
94
    }
92
}
95
}
(-)src/main/java/org/apache/taglibs/standard/tag/common/xml/JSTLXPathAPI.java (-118 / +111 lines)
Lines 39-45 Link Here
39
 * created for each evaluation.  A faster way is to precompile the
39
 * created for each evaluation.  A faster way is to precompile the
40
 * XPaths using the low-level API, and then just use the XPaths
40
 * XPaths using the low-level API, and then just use the XPaths
41
 * over and over.
41
 * over and over.
42
 *
42
 * <p/>
43
 * NOTE: In particular, each call to this method will create a new
43
 * NOTE: In particular, each call to this method will create a new
44
 * XPathContext, a new DTMManager... and thus a new DTM. That's very
44
 * XPathContext, a new DTMManager... and thus a new DTM. That's very
45
 * safe, since it guarantees that you're always processing against a
45
 * safe, since it guarantees that you're always processing against a
Lines 49-246 Link Here
49
 * methods.
49
 * methods.
50
 *
50
 *
51
 * @see <a href="http://www.w3.org/TR/xpath">XPath Specification</a>
51
 * @see <a href="http://www.w3.org/TR/xpath">XPath Specification</a>
52
 * 
53
 */
52
 */
54
public class JSTLXPathAPI extends XPathAPI {    
53
public class JSTLXPathAPI extends XPathAPI {
55
    /**
54
    /**
56
     * Use an XPath string to select a single node.
55
     * Use an XPath string to select a single node.
57
     * XPath namespace prefixes are resolved using the prefixResolver.
56
     * XPath namespace prefixes are resolved using the prefixResolver.
58
     *
57
     *
59
     * @param contextNode The node to start searching from.
58
     * @param contextNode    The node to start searching from.
60
     * @param str A valid XPath string.
59
     * @param str            A valid XPath string.
61
     * @param prefixResolver The PrefixResolver using which prefixes in the XPath will be resolved to namespaces.
60
     * @param prefixResolver The PrefixResolver using which prefixes in the XPath will be resolved to namespaces.
62
     * @return The first node found that matches the XPath, or null.
61
     * @return The first node found that matches the XPath, or null.
63
     *
64
     * @throws JspTagException
62
     * @throws JspTagException
65
     */
63
     */
66
    public static Node selectSingleNode(
64
    public static Node selectSingleNode(
67
    Node contextNode, String str, PrefixResolver prefixResolver)
65
            Node contextNode, String str, PrefixResolver prefixResolver)
68
    throws JspTagException {
66
            throws JspTagException {
69
        
67
70
        // Have the XObject return its result as a NodeSetDTM.
68
        // Have the XObject return its result as a NodeSetDTM.
71
        NodeIterator nl = selectNodeIterator(contextNode, str, prefixResolver);
69
        NodeIterator nl = selectNodeIterator(contextNode, str, prefixResolver);
72
        
70
73
        // Return the first node, or null
71
        // Return the first node, or null
74
        return nl.nextNode();
72
        return nl.nextNode();
75
    }
73
    }
76
    
74
77
    /**
75
    /**
78
     * Use an XPath string to select a single node.
76
     * Use an XPath string to select a single node.
79
     * XPath namespace prefixes are resolved using the prefixResolver.
77
     * XPath namespace prefixes are resolved using the prefixResolver.
80
     *
78
     *
81
     * @param contextNode The node to start searching from.
79
     * @param contextNode    The node to start searching from.
82
     * @param str A valid XPath string.
80
     * @param str            A valid XPath string.
83
     * @param prefixResolver The PrefixResolver using which prefixes in the XPath will be resolved to namespaces.
81
     * @param prefixResolver The PrefixResolver using which prefixes in the XPath will be resolved to namespaces.
84
     * @return The first node found that matches the XPath, or null.
82
     * @return The first node found that matches the XPath, or null.
85
     *
86
     * @throws JspTagException
83
     * @throws JspTagException
87
     */
84
     */
88
    public static Node selectSingleNode(
85
    public static Node selectSingleNode(
89
    Node contextNode, String str, PrefixResolver prefixResolver,
86
            Node contextNode, String str, PrefixResolver prefixResolver,
90
    XPathContext xpathSupport ) throws JspTagException {
87
            XPathContext xpathSupport) throws JspTagException {
91
        
88
92
        // Have the XObject return its result as a NodeSetDTM.
89
        // Have the XObject return its result as a NodeSetDTM.
93
        NodeIterator nl = selectNodeIterator(contextNode, str, prefixResolver, xpathSupport);
90
        NodeIterator nl = selectNodeIterator(contextNode, str, prefixResolver, xpathSupport);
94
        
91
95
        // Return the first node, or null
92
        // Return the first node, or null
96
        return nl.nextNode();
93
        return nl.nextNode();
97
    }
94
    }
98
    
95
99
    /**
96
    /**
100
     *  Use an XPath string to select a nodelist.
97
     * Use an XPath string to select a nodelist.
101
     *  XPath namespace prefixes are resolved using PrefixResolver.
98
     * XPath namespace prefixes are resolved using PrefixResolver.
102
     *
99
     *
103
     *  @param contextNode The node to start searching from.
100
     * @param contextNode    The node to start searching from.
104
     *  @param str A valid XPath string.
101
     * @param str            A valid XPath string.
105
     *  @param prefixResolver The PrefixResolver using which prefixes in the XPath will be resolved to namespaces.
102
     * @param prefixResolver The PrefixResolver using which prefixes in the XPath will be resolved to namespaces.
106
     *  @return A NodeIterator, should never be null.
103
     * @return A NodeIterator, should never be null.
107
     *
108
     * @throws JspTagException
104
     * @throws JspTagException
109
     */
105
     */
110
    public static NodeIterator selectNodeIterator(
106
    public static NodeIterator selectNodeIterator(
111
    Node contextNode, String str, PrefixResolver prefixResolver)
107
            Node contextNode, String str, PrefixResolver prefixResolver)
112
    throws JspTagException {
108
            throws JspTagException {
113
        
109
114
        // Execute the XPath, and have it return the result
110
        // Execute the XPath, and have it return the result
115
        XObject list = eval(contextNode, str, prefixResolver, null);
111
        XObject list = eval(contextNode, str, prefixResolver, null);
116
        
112
117
        // Have the XObject return its result as a NodeSetDTM.
113
        // Have the XObject return its result as a NodeSetDTM.
118
        return getNodeIterator(list);
114
        return getNodeIterator(list);
119
    }
115
    }
120
    
116
121
    /**
117
    /**
122
     *  Use an XPath string to select a nodelist.
118
     * Use an XPath string to select a nodelist.
123
     *  XPath namespace prefixes are resolved using PrefixResolver.
119
     * XPath namespace prefixes are resolved using PrefixResolver.
124
     *
120
     *
125
     *  @param contextNode The node to start searching from.
121
     * @param contextNode    The node to start searching from.
126
     *  @param str A valid XPath string.
122
     * @param str            A valid XPath string.
127
     *  @param prefixResolver The PrefixResolver using which prefixes in the XPath will be resolved to namespaces.
123
     * @param prefixResolver The PrefixResolver using which prefixes in the XPath will be resolved to namespaces.
128
     *  @return A NodeIterator, should never be null.
124
     * @return A NodeIterator, should never be null.
129
     *
130
     * @throws JspTagException
125
     * @throws JspTagException
131
     */
126
     */
132
    public static NodeIterator selectNodeIterator(
127
    public static NodeIterator selectNodeIterator(
133
    Node contextNode, String str, PrefixResolver prefixResolver,
128
            Node contextNode, String str, PrefixResolver prefixResolver,
134
    XPathContext xpathSupport ) throws JspTagException {
129
            XPathContext xpathSupport) throws JspTagException {
135
        
130
136
        // Execute the XPath, and have it return the result
131
        // Execute the XPath, and have it return the result
137
        XObject list = eval(contextNode, str, prefixResolver, xpathSupport);
132
        XObject list = eval(contextNode, str, prefixResolver, xpathSupport);
138
        
133
139
        // Have the XObject return its result as a NodeSetDTM.
134
        // Have the XObject return its result as a NodeSetDTM.
140
        return getNodeIterator(list);
135
        return getNodeIterator(list);
141
    }
136
    }
142
    
137
143
    /**
138
    /**
144
     *  Use an XPath string to select a nodelist.
139
     * Use an XPath string to select a nodelist.
145
     *  XPath namespace prefixes are resolved using the prefixResolver.
140
     * XPath namespace prefixes are resolved using the prefixResolver.
146
     *
141
     *
147
     *  @param contextNode The node to start searching from.
142
     * @param contextNode    The node to start searching from.
148
     *  @param str A valid XPath string.
143
     * @param str            A valid XPath string.
149
     *  @param prefixResolver The PrefixResolver using which prefixes in the XPath will be resolved to namespaces.
144
     * @param prefixResolver The PrefixResolver using which prefixes in the XPath will be resolved to namespaces.
150
     *  @return A NodeIterator, should never be null.
145
     * @return A NodeIterator, should never be null.
151
     *
152
     * @throws JspTagException
146
     * @throws JspTagException
153
     */
147
     */
154
    private static NodeList selectNodeList(
148
    private static NodeList selectNodeList(
155
    Node contextNode, String str, PrefixResolver prefixResolver)
149
            Node contextNode, String str, PrefixResolver prefixResolver)
156
    throws JspTagException {
150
            throws JspTagException {
157
        // Execute the XPath, and have it return the result
151
        // Execute the XPath, and have it return the result
158
        XObject list = eval(contextNode, str, prefixResolver, null);
152
        XObject list = eval(contextNode, str, prefixResolver, null);
159
        
153
160
        // Return a NodeList.
154
        // Return a NodeList.
161
        return getNodeList(list);
155
        return getNodeList(list);
162
    }
156
    }
163
    
157
164
    /**
158
    /**
165
     *  Use an XPath string to select a nodelist.
159
     * Use an XPath string to select a nodelist.
166
     *  XPath namespace prefixes are resolved using the prefixResolver.
160
     * XPath namespace prefixes are resolved using the prefixResolver.
167
     *
161
     *
168
     *  @param contextNode The node to start searching from.
162
     * @param contextNode    The node to start searching from.
169
     *  @param str A valid XPath string.
163
     * @param str            A valid XPath string.
170
     *  @param prefixResolver The PrefixResolver using which prefixes in the XPath will be resolved to namespaces.
164
     * @param prefixResolver The PrefixResolver using which prefixes in the XPath will be resolved to namespaces.
171
     *  @return A NodeIterator, should never be null.
165
     * @return A NodeIterator, should never be null.
172
     *
173
     * @throws JspTagException
166
     * @throws JspTagException
174
     */
167
     */
175
    public static NodeList selectNodeList(
168
    public static NodeList selectNodeList(
176
    Node contextNode, String str, PrefixResolver prefixResolver,
169
            Node contextNode, String str, PrefixResolver prefixResolver,
177
    XPathContext xpathSupport ) 
170
            XPathContext xpathSupport)
178
    throws JspTagException 
171
            throws JspTagException {
179
    {        
180
        // Execute the XPath, and have it return the result
172
        // Execute the XPath, and have it return the result
181
        XObject list = eval(contextNode, str, prefixResolver, xpathSupport);
173
        XObject list = eval(contextNode, str, prefixResolver, xpathSupport);
182
        
174
183
        // Return a NodeList.
175
        // Return a NodeList.
184
        return getNodeList(list);
176
        return getNodeList(list);
185
    }
177
    }
186
        
178
187
    /**
179
    /**
188
     * Returns a NodeIterator from an XObject.
180
     * Returns a NodeIterator from an XObject.
189
     *  @param list The XObject from which a NodeIterator is returned.
181
     *
190
     *  @return A NodeIterator, should never be null.
182
     * @param list The XObject from which a NodeIterator is returned.
191
     *  @throws JspTagException
183
     * @return A NodeIterator, should never be null.
184
     * @throws JspTagException
192
     */
185
     */
193
    private static NodeIterator getNodeIterator(XObject list) 
186
    private static NodeIterator getNodeIterator(XObject list)
194
    throws JspTagException {
187
            throws JspTagException {
195
        try {
188
        try {
196
            return list.nodeset();
189
            return list.nodeset();
197
        } catch (TransformerException ex) {
190
        } catch (TransformerException ex) {
198
            throw new JspTagException(
191
            throw new JspTagException(
199
                Resources.getMessage("XPATH_ERROR_XOBJECT", ex.toString()), ex);            
192
                    Resources.getMessage("XPATH_ERROR_XOBJECT", ex.toString()), ex);
200
        }
193
        }
201
    }        
194
    }
202
195
203
    /**
196
    /**
204
     * Returns a NodeList from an XObject.
197
     * Returns a NodeList from an XObject.
205
     *  @param list The XObject from which a NodeList is returned.
198
     *
206
     *  @return A NodeList, should never be null.
199
     * @param list The XObject from which a NodeList is returned.
207
     *  @throws JspTagException
200
     * @return A NodeList, should never be null.
201
     * @throws JspTagException
208
     */
202
     */
209
    static NodeList getNodeList(XObject list) 
203
    static NodeList getNodeList(XObject list)
210
    throws JspTagException {
204
            throws JspTagException {
211
        try {
205
        try {
212
            return list.nodelist();
206
            return list.nodelist();
213
        } catch (TransformerException ex) {
207
        } catch (TransformerException ex) {
214
            throw new JspTagException(
208
            throw new JspTagException(
215
                Resources.getMessage("XPATH_ERROR_XOBJECT", ex.toString()), ex);            
209
                    Resources.getMessage("XPATH_ERROR_XOBJECT", ex.toString()), ex);
216
        }
210
        }
217
    }        
211
    }
218
    
212
219
    /**
213
    /**
220
     *   Evaluate XPath string to an XObject.
214
     * Evaluate XPath string to an XObject.
221
     *   XPath namespace prefixes are resolved from the namespaceNode.
215
     * XPath namespace prefixes are resolved from the namespaceNode.
222
     *   The implementation of this is a little slow, since it creates
216
     * The implementation of this is a little slow, since it creates
223
     *   a number of objects each time it is called.  This could be optimized
217
     * a number of objects each time it is called.  This could be optimized
224
     *   to keep the same objects around, but then thread-safety issues would arise.
218
     * to keep the same objects around, but then thread-safety issues would arise.
225
     *
219
     *
226
     *   @param contextNode The node to start searching from.
220
     * @param contextNode    The node to start searching from.
227
     *   @param str A valid XPath string.
221
     * @param str            A valid XPath string.
228
     *   @param xpathSupport The node from which prefixes in the XPath will be resolved to namespaces.
222
     * @param xpathSupport   The node from which prefixes in the XPath will be resolved to namespaces.
229
     *   @param prefixResolver Will be called if the parser encounters namespace
223
     * @param prefixResolver Will be called if the parser encounters namespace
230
     *                         prefixes, to resolve the prefixes to URLs.
224
     *                       prefixes, to resolve the prefixes to URLs.
231
     *   @return An XObject, which can be used to obtain a string, number, nodelist, etc, should never be null.
225
     * @return An XObject, which can be used to obtain a string, number, nodelist, etc, should never be null.
232
     *   @see org.apache.xpath.objects.XObject
233
     *   @see org.apache.xpath.objects.XNull
234
     *   @see org.apache.xpath.objects.XBoolean
235
     *   @see org.apache.xpath.objects.XNumber
236
     *   @see org.apache.xpath.objects.XString
237
     *   @see org.apache.xpath.objects.XRTreeFrag
238
     *
239
     * @throws JspTagException
226
     * @throws JspTagException
227
     * @see org.apache.xpath.objects.XObject
228
     * @see org.apache.xpath.objects.XNull
229
     * @see org.apache.xpath.objects.XBoolean
230
     * @see org.apache.xpath.objects.XNumber
231
     * @see org.apache.xpath.objects.XString
232
     * @see org.apache.xpath.objects.XRTreeFrag
240
     */
233
     */
241
    public static XObject eval(
234
    public static XObject eval(
242
    Node contextNode, String str, PrefixResolver prefixResolver,
235
            Node contextNode, String str, PrefixResolver prefixResolver,
243
    XPathContext xpathSupport) throws JspTagException {
236
            XPathContext xpathSupport) throws JspTagException {
244
        //System.out.println("eval of XPathContext params: contextNode:str(xpath)"+
237
        //System.out.println("eval of XPathContext params: contextNode:str(xpath)"+
245
        // ":prefixResolver:xpathSupport => " + contextNode + ":" + str + ":" +
238
        // ":prefixResolver:xpathSupport => " + contextNode + ":" + str + ":" +
246
        //  prefixResolver + ":" + xpathSupport );        
239
        //  prefixResolver + ":" + xpathSupport );        
Lines 248-254 Link Here
248
            if (xpathSupport == null) {
241
            if (xpathSupport == null) {
249
                return eval(contextNode, str, prefixResolver);
242
                return eval(contextNode, str, prefixResolver);
250
            }
243
            }
251
            
244
252
            // Since we don't have a XML Parser involved here, install some default support
245
            // Since we don't have a XML Parser involved here, install some default support
253
            // for things like namespaces, etc.
246
            // for things like namespaces, etc.
254
            // (Changed from: XPathContext xpathSupport = new XPathContext();
247
            // (Changed from: XPathContext xpathSupport = new XPathContext();
Lines 256-280 Link Here
256
            //    XPathContext should be done away with.)
249
            //    XPathContext should be done away with.)
257
            // Create the XPath object.
250
            // Create the XPath object.
258
            XPath xpath = new XPath(str, null, prefixResolver, XPath.SELECT, null);
251
            XPath xpath = new XPath(str, null, prefixResolver, XPath.SELECT, null);
259
            
252
260
            // Execute the XPath, and have it return the result
253
            // Execute the XPath, and have it return the result
261
            int ctxtNode = xpathSupport.getDTMHandleFromNode(contextNode);
254
            int ctxtNode = xpathSupport.getDTMHandleFromNode(contextNode);
262
            
255
263
            // System.out.println("Context Node id ( after getDTMHandlerFromNode) => " + ctxtNode );
256
            // System.out.println("Context Node id ( after getDTMHandlerFromNode) => " + ctxtNode );
264
            XObject xobj = xpath.execute(xpathSupport, ctxtNode, prefixResolver);
257
            XObject xobj = xpath.execute(xpathSupport, ctxtNode, prefixResolver);
265
            return xobj;
258
            return xobj;
266
        } catch (TransformerException ex) {
259
        } catch (TransformerException ex) {
267
            throw new JspTagException(
260
            throw new JspTagException(
268
                Resources.getMessage("XPATH_ERROR_EVALUATING_EXPR", str, ex.toString()), ex);            
261
                    Resources.getMessage("XPATH_ERROR_EVALUATING_EXPR", str, ex.toString()), ex);
269
        } catch (IllegalArgumentException ex) {
262
        } catch (IllegalArgumentException ex) {
270
            throw new JspTagException(
263
            throw new JspTagException(
271
                Resources.getMessage("XPATH_ILLEGAL_ARG_EVALUATING_EXPR", str, ex.toString()), ex);            
264
                    Resources.getMessage("XPATH_ILLEGAL_ARG_EVALUATING_EXPR", str, ex.toString()), ex);
272
        }
265
        }
273
    }
266
    }
274
    
267
275
    public static XObject eval(
268
    public static XObject eval(
276
    Node contextNode, String str, PrefixResolver prefixResolver,
269
            Node contextNode, String str, PrefixResolver prefixResolver,
277
    XPathContext xpathSupport, Vector varQNames) throws JspTagException {
270
            XPathContext xpathSupport, Vector varQNames) throws JspTagException {
278
        //p("***************** eval ");
271
        //p("***************** eval ");
279
        //p( "contextNode => " + contextNode );
272
        //p( "contextNode => " + contextNode );
280
        //p( "XPath str => " + str );
273
        //p( "XPath str => " + str );
Lines 283-304 Link Here
283
        //p( "Var QNames => " + varQNames );
276
        //p( "Var QNames => " + varQNames );
284
        //p( "Global Var Size => " + varQNames.size() );        
277
        //p( "Global Var Size => " + varQNames.size() );        
285
        try {
278
        try {
286
            XPath xpath = new XPath(str, null, prefixResolver, XPath.SELECT, null);            
279
            XPath xpath = new XPath(str, null, prefixResolver, XPath.SELECT, null);
287
            xpath.fixupVariables( varQNames, varQNames.size());
280
            xpath.fixupVariables(varQNames, varQNames.size());
288
            // Execute the XPath, and have it return the result
281
            // Execute the XPath, and have it return the result
289
            int ctxtNode = xpathSupport.getDTMHandleFromNode(contextNode);            
282
            int ctxtNode = xpathSupport.getDTMHandleFromNode(contextNode);
290
            // System.out.println("Context Node id ( after getDTMHandlerFromNode) => " + ctxtNode );            
283
            // System.out.println("Context Node id ( after getDTMHandlerFromNode) => " + ctxtNode );            
291
            return xpath.execute(xpathSupport, ctxtNode, prefixResolver);
284
            return xpath.execute(xpathSupport, ctxtNode, prefixResolver);
292
        } catch (TransformerException ex) {
285
        } catch (TransformerException ex) {
293
            throw new JspTagException(
286
            throw new JspTagException(
294
            Resources.getMessage("XPATH_ERROR_EVALUATING_EXPR", str, ex.toString()), ex);
287
                    Resources.getMessage("XPATH_ERROR_EVALUATING_EXPR", str, ex.toString()), ex);
295
        } catch (IllegalArgumentException ex) {
288
        } catch (IllegalArgumentException ex) {
296
            throw new JspTagException(
289
            throw new JspTagException(
297
            Resources.getMessage("XPATH_ILLEGAL_ARG_EVALUATING_EXPR", str, ex.toString()), ex);
290
                    Resources.getMessage("XPATH_ILLEGAL_ARG_EVALUATING_EXPR", str, ex.toString()), ex);
298
        }
291
        }
299
    } 
292
    }
300
    
293
301
    private static void p(String s) {
294
    private static void p(String s) {
302
        System.out.println("[JSTLXPathAPI] " + s);
295
        System.out.println("[JSTLXPathAPI] " + s);
303
    }    
296
    }
304
}
297
}
(-)src/main/java/org/apache/taglibs/standard/tag/common/xml/JSTLPrefixResolver.java (-100 / +91 lines)
Lines 28-154 Link Here
28
 * can be used to perform prefix-to-namespace lookup
28
 * can be used to perform prefix-to-namespace lookup
29
 * for the XPath object.
29
 * for the XPath object.
30
 */
30
 */
31
public class JSTLPrefixResolver implements PrefixResolver
31
public class JSTLPrefixResolver implements PrefixResolver {
32
{
33
32
34
  /**
33
    /**
35
   * The context to resolve the prefix from, if the context
34
     * The context to resolve the prefix from, if the context
36
   * is not given. */
35
     * is not given.
36
     */
37
37
38
    HashMap namespaces;
38
    HashMap namespaces;
39
39
40
  /**
40
    /**
41
   * The URI for the XML namespace.
41
     * The URI for the XML namespace.
42
   * (Duplicate of that found in org.apache.xpath.XPathContext). */
42
     * (Duplicate of that found in org.apache.xpath.XPathContext).
43
     
43
     */
44
  public static final String S_XMLNAMESPACEURI =
45
    "http://www.w3.org/XML/1998/namespace";
46
44
47
  /**
45
    public static final String S_XMLNAMESPACEURI =
48
   * No-arg constructor which would create empty HashMap of namespaces
46
            "http://www.w3.org/XML/1998/namespace";
49
   */
50
  public JSTLPrefixResolver()
51
  {
52
    namespaces = new HashMap();
53
  }
54
47
55
  public JSTLPrefixResolver( HashMap nses )
48
    /**
56
  {
49
     * No-arg constructor which would create empty HashMap of namespaces
57
    namespaces = nses;
50
     */
58
  }
51
    public JSTLPrefixResolver() {
52
        namespaces = new HashMap();
53
    }
59
54
60
  /**
55
    public JSTLPrefixResolver(HashMap nses) {
61
   * Given a namespace, get the corresponding prefix.  This assumes that
56
        namespaces = nses;
62
   * the PrevixResolver hold's it's own namespace context, or is a namespace
57
    }
63
   * context itself.
64
   * @param prefix Prefix to resolve.
65
   * @return Namespace that prefix resolves to, or null if prefix
66
   * is not bound.
67
   */
68
  public String getNamespaceForPrefix(String prefix)
69
  {
70
    return (String)namespaces.get(prefix);
71
  }
72
58
73
  /**
59
    /**
74
   * Given a prefix and a Context Node, get the corresponding namespace.
60
     * Given a namespace, get the corresponding prefix.  This assumes that
75
   * Warning: This will not work correctly if namespaceContext
61
     * the PrevixResolver hold's it's own namespace context, or is a namespace
76
   * is an attribute node.
62
     * context itself.
77
   * @param prefix Prefix to resolve.
63
     *
78
   * @param namespaceContext Node from which to start searching for a
64
     * @param prefix Prefix to resolve.
79
   * xmlns attribute that binds a prefix to a namespace.
65
     * @return Namespace that prefix resolves to, or null if prefix
80
   * @return Namespace that prefix resolves to, or null if prefix
66
     *         is not bound.
81
   * is not bound.
67
     */
82
   */
68
    public String getNamespaceForPrefix(String prefix) {
83
  public String getNamespaceForPrefix(String prefix,
69
        return (String) namespaces.get(prefix);
84
                                      org.w3c.dom.Node namespaceContext)
70
    }
85
  {
86
71
87
    Node parent = namespaceContext;
72
    /**
88
    String namespace = null;
73
     * Given a prefix and a Context Node, get the corresponding namespace.
74
     * Warning: This will not work correctly if namespaceContext
75
     * is an attribute node.
76
     *
77
     * @param prefix           Prefix to resolve.
78
     * @param namespaceContext Node from which to start searching for a
79
     *                         xmlns attribute that binds a prefix to a namespace.
80
     * @return Namespace that prefix resolves to, or null if prefix
81
     *         is not bound.
82
     */
83
    public String getNamespaceForPrefix(String prefix,
84
                                        org.w3c.dom.Node namespaceContext) {
89
85
90
    if (prefix.equals("xml"))
86
        Node parent = namespaceContext;
91
    {
87
        String namespace = null;
92
      namespace = S_XMLNAMESPACEURI;
93
    }
94
    else
95
    {
96
      int type;
97
88
98
      while ((null != parent) && (null == namespace)
89
        if (prefix.equals("xml")) {
99
             && (((type = parent.getNodeType()) == Node.ELEMENT_NODE)
90
            namespace = S_XMLNAMESPACEURI;
100
                 || (type == Node.ENTITY_REFERENCE_NODE)))
91
        } else {
101
      {
92
            int type;
102
        if (type == Node.ELEMENT_NODE)
103
        {
104
          NamedNodeMap nnm = parent.getAttributes();
105
93
106
          for (int i = 0; i < nnm.getLength(); i++)
94
            while ((null != parent) && (null == namespace)
107
          {
95
                    && (((type = parent.getNodeType()) == Node.ELEMENT_NODE)
108
            Node attr = nnm.item(i);
96
                    || (type == Node.ENTITY_REFERENCE_NODE))) {
109
            String aname = attr.getNodeName();
97
                if (type == Node.ELEMENT_NODE) {
110
            boolean isPrefix = aname.startsWith("xmlns:");
98
                    NamedNodeMap nnm = parent.getAttributes();
111
99
112
            if (isPrefix || aname.equals("xmlns"))
100
                    for (int i = 0; i < nnm.getLength(); i++) {
113
            {
101
                        Node attr = nnm.item(i);
114
              int index = aname.indexOf(':');
102
                        String aname = attr.getNodeName();
115
              String p = isPrefix ? aname.substring(index + 1) : "";
103
                        boolean isPrefix = aname.startsWith("xmlns:");
116
104
117
              if (p.equals(prefix))
105
                        if (isPrefix || aname.equals("xmlns")) {
118
              {
106
                            int index = aname.indexOf(':');
119
                namespace = attr.getNodeValue();
107
                            String p = isPrefix ? aname.substring(index + 1) : "";
120
108
121
                break;
109
                            if (p.equals(prefix)) {
122
              }
110
                                namespace = attr.getNodeValue();
111
112
                                break;
113
                            }
114
                        }
115
                    }
116
                }
117
118
                parent = parent.getParentNode();
123
            }
119
            }
124
          }
125
        }
120
        }
126
121
127
        parent = parent.getParentNode();
122
        return namespace;
128
      }
129
    }
123
    }
130
124
131
    return namespace;
125
    /**
132
  }
126
     * Return the base identifier.
127
     *
128
     * @return null
129
     */
130
    public String getBaseIdentifier() {
131
        return null;
132
    }
133
133
134
  /**
134
    /**
135
   * Return the base identifier.
135
     * @see PrefixResolver#handlesNullPrefixes()
136
   *
136
     */
137
   * @return null
137
    public boolean handlesNullPrefixes() {
138
   */
138
        return false;
139
  public String getBaseIdentifier()
139
    }
140
  {
141
    return null;
142
  }
143
140
144
  /**
141
    public void addNamespace(String prefix, String uri) {
145
   * @see PrefixResolver#handlesNullPrefixes() */
142
        namespaces.put(prefix, uri);
146
  public boolean handlesNullPrefixes() {
143
    }
147
    return false;
148
  }
149
144
150
  public void addNamespace ( String prefix, String uri ) {
151
    namespaces.put( prefix, uri );
152
  }
153
154
}
145
}
(-)src/main/java/org/apache/taglibs/standard/tag/common/xml/ParamSupport.java (-18 / +22 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tag.common.xml;
18
package org.apache.taglibs.standard.tag.common.xml;
19
19
Lines 28-35 Link Here
28
 * <p>Support for tag handlers for &lt;param&gt;, the XML parameter
28
 * <p>Support for tag handlers for &lt;param&gt;, the XML parameter
29
 * subtag for &lt;transformt&lt;.</p>
29
 * subtag for &lt;transformt&lt;.</p>
30
 *
30
 *
31
 * @author Shawn Bayern
31
 * @see TransformSupport
32
 * @see TransformSupport
32
 * @author Shawn Bayern
33
 */
33
 */
34
34
35
public abstract class ParamSupport extends BodyTagSupport {
35
public abstract class ParamSupport extends BodyTagSupport {
Lines 44-56 Link Here
44
    // Constructor and initialization
44
    // Constructor and initialization
45
45
46
    public ParamSupport() {
46
    public ParamSupport() {
47
	super();
47
        super();
48
	init();
48
        init();
49
    }
49
    }
50
50
51
    private void init() {
51
    private void init() {
52
	name = null;
52
        name = null;
53
	value = null;
53
        value = null;
54
    }
54
    }
55
55
56
56
Lines 58-85 Link Here
58
    // Tag logic
58
    // Tag logic
59
59
60
    // simply send our name and value to our parent <transform> tag
60
    // simply send our name and value to our parent <transform> tag
61
61
    @Override
62
    @Override
62
    public int doEndTag() throws JspException {
63
    public int doEndTag() throws JspException {
63
	Tag t = findAncestorWithClass(this, TransformSupport.class);
64
        Tag t = findAncestorWithClass(this, TransformSupport.class);
64
	if (t == null)
65
        if (t == null) {
65
	    throw new JspTagException(
66
            throw new JspTagException(
66
		Resources.getMessage("PARAM_OUTSIDE_TRANSFORM"));
67
                    Resources.getMessage("PARAM_OUTSIDE_TRANSFORM"));
67
	TransformSupport parent = (TransformSupport) t;
68
        }
69
        TransformSupport parent = (TransformSupport) t;
68
70
69
	Object value = this.value;
71
        Object value = this.value;
70
	if (value == null) {
72
        if (value == null) {
71
            if (bodyContent == null || bodyContent.getString() == null)
73
            if (bodyContent == null || bodyContent.getString() == null) {
72
                value = "";
74
                value = "";
73
            else
75
            } else {
74
                value = bodyContent.getString().trim();
76
                value = bodyContent.getString().trim();
77
            }
75
        }
78
        }
76
	parent.addParameter(name, value);
79
        parent.addParameter(name, value);
77
	return EVAL_PAGE;
80
        return EVAL_PAGE;
78
    }
81
    }
79
82
80
    // Releases any resources we may have (or inherit)
83
    // Releases any resources we may have (or inherit)
84
81
    @Override
85
    @Override
82
    public void release() {
86
    public void release() {
83
	init();
87
        init();
84
    }
88
    }
85
}
89
}
(-)src/main/java/org/apache/taglibs/standard/tag/common/xml/WhenTag.java (-1 / +4 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tag.common.xml;
18
package org.apache.taglibs.standard.tag.common.xml;
19
19
Lines 33-44 Link Here
33
    // Constructor and lifecycle management
33
    // Constructor and lifecycle management
34
34
35
    // initialize inherited and local state
35
    // initialize inherited and local state
36
36
    public WhenTag() {
37
    public WhenTag() {
37
        super();
38
        super();
38
        init();
39
        init();
39
    }
40
    }
40
41
41
    // Releases any resources we may have (or inherit)
42
    // Releases any resources we may have (or inherit)
43
42
    @Override
44
    @Override
43
    public void release() {
45
    public void release() {
44
        super.release();
46
        super.release();
Lines 73-78 Link Here
73
    // Private utility methods
75
    // Private utility methods
74
76
75
    // resets internal state
77
    // resets internal state
78
76
    private void init() {
79
    private void init() {
77
        select = null;
80
        select = null;
78
    }
81
    }
(-)src/main/java/org/apache/taglibs/standard/tag/common/fmt/ParseNumberSupport.java (-86 / +90 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tag.common.fmt;
18
package org.apache.taglibs.standard.tag.common.fmt;
19
19
Lines 44-50 Link Here
44
    //*********************************************************************
44
    //*********************************************************************
45
    // Private constants
45
    // Private constants
46
46
47
    private static final String NUMBER = "number";    
47
    private static final String NUMBER = "number";
48
    private static final String CURRENCY = "currency";
48
    private static final String CURRENCY = "currency";
49
    private static final String PERCENT = "percent";
49
    private static final String PERCENT = "percent";
50
50
Lines 53-59 Link Here
53
    // Protected state
53
    // Protected state
54
54
55
    protected String value;                      // 'value' attribute
55
    protected String value;                      // 'value' attribute
56
    protected boolean valueSpecified;	         // status
56
    protected boolean valueSpecified;             // status
57
    protected String type;                       // 'type' attribute
57
    protected String type;                       // 'type' attribute
58
    protected String pattern;                    // 'pattern' attribute
58
    protected String pattern;                    // 'pattern' attribute
59
    protected Locale parseLocale;                // 'parseLocale' attribute
59
    protected Locale parseLocale;                // 'parseLocale' attribute
Lines 72-91 Link Here
72
    // Constructor and initialization
72
    // Constructor and initialization
73
73
74
    public ParseNumberSupport() {
74
    public ParseNumberSupport() {
75
	super();
75
        super();
76
	init();
76
        init();
77
    }
77
    }
78
78
79
    private void init() {
79
    private void init() {
80
	value = type = pattern = var = null;
80
        value = type = pattern = var = null;
81
	valueSpecified = false;
81
        valueSpecified = false;
82
	parseLocale = null;
82
        parseLocale = null;
83
	integerOnlySpecified = false;
83
        integerOnlySpecified = false;
84
	scope = PageContext.PAGE_SCOPE;
84
        scope = PageContext.PAGE_SCOPE;
85
    }
85
    }
86
86
87
87
88
   //*********************************************************************
88
    //*********************************************************************
89
    // Tag attributes known at translation time
89
    // Tag attributes known at translation time
90
90
91
    public void setVar(String var) {
91
    public void setVar(String var) {
Lines 93-99 Link Here
93
    }
93
    }
94
94
95
    public void setScope(String scope) {
95
    public void setScope(String scope) {
96
	this.scope = Util.getScope(scope);
96
        this.scope = Util.getScope(scope);
97
    }
97
    }
98
98
99
99
Lines 102-183 Link Here
102
102
103
    @Override
103
    @Override
104
    public int doEndTag() throws JspException {
104
    public int doEndTag() throws JspException {
105
	String input = null;
105
        String input = null;
106
106
107
        // determine the input by...
107
        // determine the input by...
108
	if (valueSpecified) {
108
        if (valueSpecified) {
109
	    // ... reading 'value' attribute
109
            // ... reading 'value' attribute
110
	    input = value;
110
            input = value;
111
	} else {
111
        } else {
112
	    // ... retrieving and trimming our body
112
            // ... retrieving and trimming our body
113
	    if (bodyContent != null && bodyContent.getString() != null)
113
            if (bodyContent != null && bodyContent.getString() != null) {
114
	        input = bodyContent.getString().trim();
114
                input = bodyContent.getString().trim();
115
	}
115
            }
116
        }
116
117
117
	if ((input == null) || input.equals("")) {
118
        if ((input == null) || input.equals("")) {
118
	    if (var != null) {
119
            if (var != null) {
119
		pageContext.removeAttribute(var, scope);
120
                pageContext.removeAttribute(var, scope);
120
	    }
121
            }
121
	    return EVAL_PAGE;
122
            return EVAL_PAGE;
122
	}
123
        }
123
124
124
	/*
125
        /*
125
	 * Set up parsing locale: Use locale specified via the 'parseLocale'
126
       * Set up parsing locale: Use locale specified via the 'parseLocale'
126
	 * attribute (if present), or else determine page's locale.
127
       * attribute (if present), or else determine page's locale.
127
	 */
128
       */
128
	Locale loc = parseLocale;
129
        Locale loc = parseLocale;
129
	if (loc == null)
130
        if (loc == null) {
130
	    loc = SetLocaleSupport.getFormattingLocale(
131
            loc = SetLocaleSupport.getFormattingLocale(
131
                pageContext,
132
                    pageContext,
132
	        this,
133
                    this,
133
		false,
134
                    false,
134
	        NumberFormat.getAvailableLocales());
135
                    NumberFormat.getAvailableLocales());
135
	if (loc == null) {
136
        }
136
	    throw new JspException(
137
        if (loc == null) {
138
            throw new JspException(
137
                    Resources.getMessage("PARSE_NUMBER_NO_PARSE_LOCALE"));
139
                    Resources.getMessage("PARSE_NUMBER_NO_PARSE_LOCALE"));
138
	}
140
        }
139
141
140
	// Create parser
142
        // Create parser
141
	NumberFormat parser = null;
143
        NumberFormat parser = null;
142
	if ((pattern != null) && !pattern.equals("")) {
144
        if ((pattern != null) && !pattern.equals("")) {
143
	    // if 'pattern' is specified, 'type' is ignored
145
            // if 'pattern' is specified, 'type' is ignored
144
	    DecimalFormatSymbols symbols = new DecimalFormatSymbols(loc);
146
            DecimalFormatSymbols symbols = new DecimalFormatSymbols(loc);
145
	    parser = new DecimalFormat(pattern, symbols);
147
            parser = new DecimalFormat(pattern, symbols);
146
	} else {
148
        } else {
147
	    parser = createParser(loc);
149
            parser = createParser(loc);
148
	}
150
        }
149
151
150
	// Configure parser
152
        // Configure parser
151
	if (integerOnlySpecified)
153
        if (integerOnlySpecified) {
152
	    parser.setParseIntegerOnly(isIntegerOnly);
154
            parser.setParseIntegerOnly(isIntegerOnly);
155
        }
153
156
154
	// Parse number
157
        // Parse number
155
	Number parsed = null;
158
        Number parsed = null;
156
	try {
159
        try {
157
	    parsed = parser.parse(input);
160
            parsed = parser.parse(input);
158
	} catch (ParseException pe) {
161
        } catch (ParseException pe) {
159
	    throw new JspException(
162
            throw new JspException(
160
	            Resources.getMessage("PARSE_NUMBER_PARSE_ERROR", input),
163
                    Resources.getMessage("PARSE_NUMBER_PARSE_ERROR", input),
161
		    pe);
164
                    pe);
162
	}
165
        }
163
166
164
	if (var != null) {
167
        if (var != null) {
165
	    pageContext.setAttribute(var, parsed, scope);	
168
            pageContext.setAttribute(var, parsed, scope);
166
	} else {
169
        } else {
167
	    try {
170
            try {
168
		pageContext.getOut().print(parsed);
171
                pageContext.getOut().print(parsed);
169
	    } catch (IOException ioe) {
172
            } catch (IOException ioe) {
170
		throw new JspTagException(ioe.toString(), ioe);
173
                throw new JspTagException(ioe.toString(), ioe);
171
	    }
174
            }
172
	}
175
        }
173
176
174
	return EVAL_PAGE;
177
        return EVAL_PAGE;
175
    }
178
    }
176
179
177
    // Releases any resources we may have (or inherit)
180
    // Releases any resources we may have (or inherit)
181
178
    @Override
182
    @Override
179
    public void release() {
183
    public void release() {
180
	init();
184
        init();
181
    }
185
    }
182
186
183
187
Lines 185-204 Link Here
185
    // Private utility methods
189
    // Private utility methods
186
190
187
    private NumberFormat createParser(Locale loc) throws JspException {
191
    private NumberFormat createParser(Locale loc) throws JspException {
188
	NumberFormat parser = null;
192
        NumberFormat parser = null;
189
193
190
	if ((type == null) || NUMBER.equalsIgnoreCase(type)) {
194
        if ((type == null) || NUMBER.equalsIgnoreCase(type)) {
191
	    parser = NumberFormat.getNumberInstance(loc);
195
            parser = NumberFormat.getNumberInstance(loc);
192
	} else if (CURRENCY.equalsIgnoreCase(type)) {
196
        } else if (CURRENCY.equalsIgnoreCase(type)) {
193
	    parser = NumberFormat.getCurrencyInstance(loc);
197
            parser = NumberFormat.getCurrencyInstance(loc);
194
	} else if (PERCENT.equalsIgnoreCase(type)) {
198
        } else if (PERCENT.equalsIgnoreCase(type)) {
195
	    parser = NumberFormat.getPercentInstance(loc);
199
            parser = NumberFormat.getPercentInstance(loc);
196
	} else {
200
        } else {
197
	    throw new JspException(
201
            throw new JspException(
198
                    Resources.getMessage("PARSE_NUMBER_INVALID_TYPE", 
202
                    Resources.getMessage("PARSE_NUMBER_INVALID_TYPE",
199
					 type));
203
                            type));
200
	}
204
        }
201
205
202
	return parser;
206
        return parser;
203
    }
207
    }
204
}
208
}
(-)src/main/java/org/apache/taglibs/standard/tag/common/fmt/MessageSupport.java (-86 / +89 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tag.common.fmt;
18
package org.apache.taglibs.standard.tag.common.fmt;
19
19
Lines 53-59 Link Here
53
    // Protected state
53
    // Protected state
54
54
55
    protected String keyAttrValue;       // 'key' attribute value
55
    protected String keyAttrValue;       // 'key' attribute value
56
    protected boolean keySpecified;	 // 'key' attribute specified
56
    protected boolean keySpecified;     // 'key' attribute specified
57
    protected LocalizationContext bundleAttrValue; // 'bundle' attribute value
57
    protected LocalizationContext bundleAttrValue; // 'bundle' attribute value
58
    protected boolean bundleSpecified;   // 'bundle' attribute specified?
58
    protected boolean bundleSpecified;   // 'bundle' attribute specified?
59
59
Lines 70-87 Link Here
70
    // Constructor and initialization
70
    // Constructor and initialization
71
71
72
    public MessageSupport() {
72
    public MessageSupport() {
73
	super();
73
        super();
74
	params = new ArrayList();
74
        params = new ArrayList();
75
	init();
75
        init();
76
    }
76
    }
77
77
78
    private void init() {
78
    private void init() {
79
	var = null;
79
        var = null;
80
	scope = PageContext.PAGE_SCOPE;
80
        scope = PageContext.PAGE_SCOPE;
81
	keyAttrValue = null;
81
        keyAttrValue = null;
82
	keySpecified = false;
82
        keySpecified = false;
83
	bundleAttrValue = null;
83
        bundleAttrValue = null;
84
	bundleSpecified = false;
84
        bundleSpecified = false;
85
    }
85
    }
86
86
87
87
Lines 93-99 Link Here
93
    }
93
    }
94
94
95
    public void setScope(String scope) {
95
    public void setScope(String scope) {
96
	this.scope = Util.getScope(scope);
96
        this.scope = Util.getScope(scope);
97
    }
97
    }
98
98
99
99
Lines 106-112 Link Here
106
     * @see ParamSupport
106
     * @see ParamSupport
107
     */
107
     */
108
    public void addParam(Object arg) {
108
    public void addParam(Object arg) {
109
	params.add(arg);
109
        params.add(arg);
110
    }
110
    }
111
111
112
112
Lines 115-185 Link Here
115
115
116
    @Override
116
    @Override
117
    public int doStartTag() throws JspException {
117
    public int doStartTag() throws JspException {
118
	params.clear();
118
        params.clear();
119
	return EVAL_BODY_BUFFERED;
119
        return EVAL_BODY_BUFFERED;
120
    }
120
    }
121
121
122
    @Override
122
    @Override
123
    public int doEndTag() throws JspException {
123
    public int doEndTag() throws JspException {
124
124
125
        String key = null;
125
        String key = null;
126
	LocalizationContext locCtxt = null;
126
        LocalizationContext locCtxt = null;
127
127
128
        // determine the message key by...
128
        // determine the message key by...
129
        if (keySpecified) {
129
        if (keySpecified) {
130
	    // ... reading 'key' attribute
130
            // ... reading 'key' attribute
131
	    key = keyAttrValue;
131
            key = keyAttrValue;
132
	} else {
132
        } else {
133
	    // ... retrieving and trimming our body
133
            // ... retrieving and trimming our body
134
	    if (bodyContent != null && bodyContent.getString() != null)
134
            if (bodyContent != null && bodyContent.getString() != null) {
135
	        key = bodyContent.getString().trim();
135
                key = bodyContent.getString().trim();
136
	}
136
            }
137
        }
137
138
138
	if ((key == null) || key.equals("")) {
139
        if ((key == null) || key.equals("")) {
139
	    try {
140
            try {
140
		pageContext.getOut().print("??????");
141
                pageContext.getOut().print("??????");
141
	    } catch (IOException ioe) {
142
            } catch (IOException ioe) {
142
		throw new JspTagException(ioe.toString(), ioe);
143
                throw new JspTagException(ioe.toString(), ioe);
143
	    }
144
            }
144
	    return EVAL_PAGE;
145
            return EVAL_PAGE;
145
	}
146
        }
146
147
147
	String prefix = null;
148
        String prefix = null;
148
	if (!bundleSpecified) {
149
        if (!bundleSpecified) {
149
	    Tag t = findAncestorWithClass(this, BundleSupport.class);
150
            Tag t = findAncestorWithClass(this, BundleSupport.class);
150
	    if (t != null) {
151
            if (t != null) {
151
		// use resource bundle from parent <bundle> tag
152
                // use resource bundle from parent <bundle> tag
152
		BundleSupport parent = (BundleSupport) t;
153
                BundleSupport parent = (BundleSupport) t;
153
		locCtxt = parent.getLocalizationContext();
154
                locCtxt = parent.getLocalizationContext();
154
		prefix = parent.getPrefix();
155
                prefix = parent.getPrefix();
155
	    } else {
156
            } else {
156
		locCtxt = BundleSupport.getLocalizationContext(pageContext);
157
                locCtxt = BundleSupport.getLocalizationContext(pageContext);
157
	    }
158
            }
158
	} else {
159
        } else {
159
	    // localization context taken from 'bundle' attribute
160
            // localization context taken from 'bundle' attribute
160
	    locCtxt = bundleAttrValue;
161
            locCtxt = bundleAttrValue;
161
	    if (locCtxt.getLocale() != null) {
162
            if (locCtxt.getLocale() != null) {
162
		SetLocaleSupport.setResponseLocale(pageContext,
163
                SetLocaleSupport.setResponseLocale(pageContext,
163
						   locCtxt.getLocale());
164
                        locCtxt.getLocale());
164
	    }
165
            }
165
	}
166
        }
166
        
167
167
 	String message = UNDEFINED_KEY + key + UNDEFINED_KEY;
168
        String message = UNDEFINED_KEY + key + UNDEFINED_KEY;
168
	if (locCtxt != null) {
169
        if (locCtxt != null) {
169
	    ResourceBundle bundle = locCtxt.getResourceBundle();
170
            ResourceBundle bundle = locCtxt.getResourceBundle();
170
	    if (bundle != null) {
171
            if (bundle != null) {
171
		try {
172
                try {
172
		    // prepend 'prefix' attribute from parent bundle
173
                    // prepend 'prefix' attribute from parent bundle
173
		    if (prefix != null)
174
                    if (prefix != null) {
174
			key = prefix + key;
175
                        key = prefix + key;
175
		    message = bundle.getString(key);
176
                    }
176
		    // Perform parametric replacement if required
177
                    message = bundle.getString(key);
177
		    if (!params.isEmpty()) {
178
                    // Perform parametric replacement if required
178
			Object[] messageArgs = params.toArray();
179
                    if (!params.isEmpty()) {
179
			MessageFormat formatter = new MessageFormat(""); // empty pattern, default Locale
180
                        Object[] messageArgs = params.toArray();
180
			if (locCtxt.getLocale() != null) {
181
                        MessageFormat formatter = new MessageFormat(""); // empty pattern, default Locale
181
			    formatter.setLocale(locCtxt.getLocale());
182
                        if (locCtxt.getLocale() != null) {
182
			} else {
183
                            formatter.setLocale(locCtxt.getLocale());
184
                        } else {
183
                            // For consistency with the <fmt:formatXXX> actions,
185
                            // For consistency with the <fmt:formatXXX> actions,
184
                            // we try to get a locale that matches the user's preferences
186
                            // we try to get a locale that matches the user's preferences
185
                            // as well as the locales supported by 'date' and 'number'.
187
                            // as well as the locales supported by 'date' and 'number'.
Lines 190-220 Link Here
190
                                formatter.setLocale(locale);
192
                                formatter.setLocale(locale);
191
                            }
193
                            }
192
                        }
194
                        }
193
			formatter.applyPattern(message);
195
                        formatter.applyPattern(message);
194
			message = formatter.format(messageArgs);
196
                        message = formatter.format(messageArgs);
195
		    }
197
                    }
196
		} catch (MissingResourceException mre) {
198
                } catch (MissingResourceException mre) {
197
		    message = UNDEFINED_KEY + key + UNDEFINED_KEY;
199
                    message = UNDEFINED_KEY + key + UNDEFINED_KEY;
198
		}
200
                }
199
	    }
201
            }
200
	}
202
        }
201
203
202
	if (var != null) {
204
        if (var != null) {
203
	    pageContext.setAttribute(var, message, scope);	
205
            pageContext.setAttribute(var, message, scope);
204
	} else {
206
        } else {
205
	    try {
207
            try {
206
		pageContext.getOut().print(message);
208
                pageContext.getOut().print(message);
207
	    } catch (IOException ioe) {
209
            } catch (IOException ioe) {
208
		throw new JspTagException(ioe.toString(), ioe);
210
                throw new JspTagException(ioe.toString(), ioe);
209
	    }
211
            }
210
	}
212
        }
211
213
212
	return EVAL_PAGE;
214
        return EVAL_PAGE;
213
    }
215
    }
214
216
215
    // Releases any resources we may have (or inherit)
217
    // Releases any resources we may have (or inherit)
218
216
    @Override
219
    @Override
217
    public void release() {
220
    public void release() {
218
	init();
221
        init();
219
    }
222
    }
220
}
223
}
(-)src/main/java/org/apache/taglibs/standard/tag/common/fmt/SetBundleSupport.java (-17 / +18 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tag.common.fmt;
18
package org.apache.taglibs.standard.tag.common.fmt;
19
19
Lines 34-40 Link Here
34
34
35
public abstract class SetBundleSupport extends TagSupport {
35
public abstract class SetBundleSupport extends TagSupport {
36
36
37
    
37
38
    //*********************************************************************
38
    //*********************************************************************
39
    // Protected state
39
    // Protected state
40
40
Lines 52-64 Link Here
52
    // Constructor and initialization
52
    // Constructor and initialization
53
53
54
    public SetBundleSupport() {
54
    public SetBundleSupport() {
55
	super();
55
        super();
56
	init();
56
        init();
57
    }
57
    }
58
58
59
    private void init() {
59
    private void init() {
60
	basename = null;
60
        basename = null;
61
	scope = PageContext.PAGE_SCOPE;
61
        scope = PageContext.PAGE_SCOPE;
62
    }
62
    }
63
63
64
64
Lines 70-76 Link Here
70
    }
70
    }
71
71
72
    public void setScope(String scope) {
72
    public void setScope(String scope) {
73
	this.scope = Util.getScope(scope);
73
        this.scope = Util.getScope(scope);
74
    }
74
    }
75
75
76
76
Lines 79-100 Link Here
79
79
80
    @Override
80
    @Override
81
    public int doEndTag() throws JspException {
81
    public int doEndTag() throws JspException {
82
	LocalizationContext locCtxt =
82
        LocalizationContext locCtxt =
83
	    BundleSupport.getLocalizationContext(pageContext, basename);
83
                BundleSupport.getLocalizationContext(pageContext, basename);
84
84
85
	if (var != null) {
85
        if (var != null) {
86
	    pageContext.setAttribute(var, locCtxt, scope);
86
            pageContext.setAttribute(var, locCtxt, scope);
87
	} else {
87
        } else {
88
	    Config.set(pageContext, Config.FMT_LOCALIZATION_CONTEXT, locCtxt,
88
            Config.set(pageContext, Config.FMT_LOCALIZATION_CONTEXT, locCtxt,
89
		       scope);
89
                    scope);
90
	}
90
        }
91
91
92
	return EVAL_PAGE;
92
        return EVAL_PAGE;
93
    }
93
    }
94
94
95
    // Releases any resources we may have (or inherit)
95
    // Releases any resources we may have (or inherit)
96
96
    @Override
97
    @Override
97
    public void release() {
98
    public void release() {
98
	init();
99
        init();
99
    }
100
    }
100
}
101
}
(-)src/main/java/org/apache/taglibs/standard/tag/common/fmt/FormatDateSupport.java (-136 / +143 lines)
Lines 13-26 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tag.common.fmt;
18
package org.apache.taglibs.standard.tag.common.fmt;
19
19
20
import java.io.IOException;
20
import java.io.IOException;
21
import java.text.DateFormat;
21
import java.text.DateFormat;
22
import java.text.SimpleDateFormat;
22
import java.text.SimpleDateFormat;
23
import java.util.*;
23
import java.util.Collections;
24
import java.util.Date;
25
import java.util.LinkedHashMap;
26
import java.util.Locale;
27
import java.util.Map;
28
import java.util.TimeZone;
24
29
25
import javax.servlet.jsp.JspException;
30
import javax.servlet.jsp.JspException;
26
import javax.servlet.jsp.JspTagException;
31
import javax.servlet.jsp.JspTagException;
Lines 42-53 Link Here
42
    //*********************************************************************
47
    //*********************************************************************
43
    // Private constants
48
    // Private constants
44
49
45
	/**
50
    /**
46
	 * Name of configuration setting for maximum number of entries in the
51
     * Name of configuration setting for maximum number of entries in the
47
	 * cached dateformat map
52
     * cached dateformat map
48
	 */
53
     */
49
	private static final String DATE_CACHE_PARAM = 
54
    private static final String DATE_CACHE_PARAM =
50
		"org.apache.taglibs.standard.tag.common.fmt.dateFormatCacheSize";
55
            "org.apache.taglibs.standard.tag.common.fmt.dateFormatCacheSize";
51
56
52
    private static final String DATE = "date";
57
    private static final String DATE = "date";
53
    private static final String TIME = "time";
58
    private static final String TIME = "time";
Lines 55-64 Link Here
55
60
56
    private static Map dateFormatCache = null;
61
    private static Map dateFormatCache = null;
57
62
58
	/**
63
    /**
59
	 * Default maximum  cache size
64
     * Default maximum  cache size
60
	 */
65
     */
61
	private static final int MAX_SIZE = 100;
66
    private static final int MAX_SIZE = 100;
62
67
63
68
64
    //*********************************************************************
69
    //*********************************************************************
Lines 83-102 Link Here
83
    // Constructor and initialization
88
    // Constructor and initialization
84
89
85
    public FormatDateSupport() {
90
    public FormatDateSupport() {
86
	super();
91
        super();
87
	init();
92
        init();
88
    }
93
    }
89
94
90
    private void init() {
95
    private void init() {
91
	type = dateStyle = timeStyle = null;
96
        type = dateStyle = timeStyle = null;
92
	pattern = var = null;
97
        pattern = var = null;
93
	value = null;
98
        value = null;
94
	timeZone = null;
99
        timeZone = null;
95
	scope = PageContext.PAGE_SCOPE;
100
        scope = PageContext.PAGE_SCOPE;
96
    }
101
    }
97
102
98
103
99
   //*********************************************************************
104
    //*********************************************************************
100
    // Tag attributes known at translation time
105
    // Tag attributes known at translation time
101
106
102
    public void setVar(String var) {
107
    public void setVar(String var) {
Lines 104-110 Link Here
104
    }
109
    }
105
110
106
    public void setScope(String scope) {
111
    public void setScope(String scope) {
107
	this.scope = Util.getScope(scope);
112
        this.scope = Util.getScope(scope);
108
    }
113
    }
109
114
110
115
Lines 114-185 Link Here
114
    /*
119
    /*
115
     * Formats the given date and time.
120
     * Formats the given date and time.
116
     */
121
     */
122
117
    @Override
123
    @Override
118
    public int doEndTag() throws JspException {
124
    public int doEndTag() throws JspException {
119
125
120
	String formatted = null;
126
        String formatted = null;
121
127
122
	if (value == null) {
128
        if (value == null) {
123
	    if (var != null) {
129
            if (var != null) {
124
		pageContext.removeAttribute(var, scope);
130
                pageContext.removeAttribute(var, scope);
125
	    }
131
            }
126
	    return EVAL_PAGE;
132
            return EVAL_PAGE;
127
	}
133
        }
128
134
129
	// Create formatter
135
        // Create formatter
130
	Locale locale = SetLocaleSupport.getFormattingLocale(
136
        Locale locale = SetLocaleSupport.getFormattingLocale(
131
            pageContext,
137
                pageContext,
132
	    this,
138
                this,
133
	    true,
139
                true,
134
	    DateFormat.getAvailableLocales());
140
                DateFormat.getAvailableLocales());
135
141
136
	if (locale != null) {
142
        if (locale != null) {
137
	    DateFormat formatter = createFormatter(locale, pattern);
143
            DateFormat formatter = createFormatter(locale, pattern);
138
144
139
	    // Set time zone
145
            // Set time zone
140
	    TimeZone tz = null;
146
            TimeZone tz = null;
141
	    if ((timeZone instanceof String)
147
            if ((timeZone instanceof String)
142
		&& ((String) timeZone).equals("")) {
148
                    && ((String) timeZone).equals("")) {
143
		timeZone = null;
149
                timeZone = null;
144
	    }
150
            }
145
	    if (timeZone != null) {
151
            if (timeZone != null) {
146
		if (timeZone instanceof String) {
152
                if (timeZone instanceof String) {
147
		    tz = TimeZone.getTimeZone((String) timeZone);
153
                    tz = TimeZone.getTimeZone((String) timeZone);
148
		} else if (timeZone instanceof TimeZone) {
154
                } else if (timeZone instanceof TimeZone) {
149
		    tz = (TimeZone) timeZone;
155
                    tz = (TimeZone) timeZone;
150
		} else {
156
                } else {
151
		    throw new JspTagException(
157
                    throw new JspTagException(
152
                            Resources.getMessage("FORMAT_DATE_BAD_TIMEZONE"));
158
                            Resources.getMessage("FORMAT_DATE_BAD_TIMEZONE"));
153
		}
159
                }
154
	    } else {
160
            } else {
155
		tz = TimeZoneSupport.getTimeZone(pageContext, this);
161
                tz = TimeZoneSupport.getTimeZone(pageContext, this);
156
	    }
162
            }
157
	    if (tz != null) {
163
            if (tz != null) {
158
		formatter.setTimeZone(tz);
164
                formatter.setTimeZone(tz);
159
	    }
165
            }
160
	    formatted = formatter.format(value);
166
            formatted = formatter.format(value);
161
	} else {
167
        } else {
162
	    // no formatting locale available, use Date.toString()
168
            // no formatting locale available, use Date.toString()
163
	    formatted = value.toString();
169
            formatted = value.toString();
164
	}
170
        }
165
171
166
	if (var != null) {
172
        if (var != null) {
167
	    pageContext.setAttribute(var, formatted, scope);	
173
            pageContext.setAttribute(var, formatted, scope);
168
	} else {
174
        } else {
169
	    try {
175
            try {
170
		pageContext.getOut().print(formatted);
176
                pageContext.getOut().print(formatted);
171
	    } catch (IOException ioe) {
177
            } catch (IOException ioe) {
172
		throw new JspTagException(ioe.toString(), ioe);
178
                throw new JspTagException(ioe.toString(), ioe);
173
	    }
179
            }
174
	}
180
        }
175
181
176
	return EVAL_PAGE;
182
        return EVAL_PAGE;
177
    }
183
    }
178
184
179
    // Releases any resources we may have (or inherit)
185
    // Releases any resources we may have (or inherit)
186
180
    @Override
187
    @Override
181
    public void release() {
188
    public void release() {
182
	init();
189
        init();
183
    }
190
    }
184
191
185
192
Lines 187-268 Link Here
187
    // Private utility methods
194
    // Private utility methods
188
195
189
    private DateFormat createFormatter(Locale loc, String pattern) throws JspException {
196
    private DateFormat createFormatter(Locale loc, String pattern) throws JspException {
190
	DateFormat formatter = null;
197
        DateFormat formatter = null;
191
198
192
	// lazy initialization of cache
199
        // lazy initialization of cache
193
    if (dateFormatCache == null) {
200
        if (dateFormatCache == null) {
194
        String value = pageContext.getServletContext().getInitParameter(DATE_CACHE_PARAM);
201
            String value = pageContext.getServletContext().getInitParameter(DATE_CACHE_PARAM);
195
        final int maxSize = (value != null) ? Integer.parseInt(value) : MAX_SIZE;
202
            final int maxSize = (value != null) ? Integer.parseInt(value) : MAX_SIZE;
196
        dateFormatCache = Collections.synchronizedMap(new LinkedHashMap() {
203
            dateFormatCache = Collections.synchronizedMap(new LinkedHashMap() {
197
          @Override
204
                @Override
198
            protected boolean removeEldestEntry(Map.Entry eldest) {
205
                protected boolean removeEldestEntry(Map.Entry eldest) {
199
            return size() > maxSize;
206
                    return size() > maxSize;
207
                }
208
            });
209
        }
210
211
        // Apply pattern, if present
212
        if (pattern != null) {
213
            if ((type == null) || DATE.equalsIgnoreCase(type)) {
214
                String key = DATE + pattern + loc;
215
                formatter = (DateFormat) dateFormatCache.get(key);
216
                if (formatter == null) {
217
                    formatter = new SimpleDateFormat(pattern, loc);
218
                    dateFormatCache.put(key, formatter);
219
                }
220
            } else if (TIME.equalsIgnoreCase(type)) {
221
                String key = TIME + pattern + loc;
222
                formatter = (DateFormat) dateFormatCache.get(key);
223
                if (formatter == null) {
224
                    formatter = new SimpleDateFormat(pattern, loc);
225
                    dateFormatCache.put(key, formatter);
226
                }
227
            } else if (DATETIME.equalsIgnoreCase(type)) {
228
                String key = DATETIME + pattern + loc;
229
                formatter = (DateFormat) dateFormatCache.get(key);
230
                if (formatter == null) {
231
                    formatter = new SimpleDateFormat(pattern, loc);
232
                    dateFormatCache.put(key, formatter);
233
                }
234
            } else {
235
                throw new JspException(
236
                        Resources.getMessage("FORMAT_DATE_INVALID_TYPE",
237
                                type));
200
            }
238
            }
201
       });
239
            return formatter;
202
    }
240
        }
203
241
204
	// Apply pattern, if present
242
        if ((type == null) || DATE.equalsIgnoreCase(type)) {
205
	if (pattern != null) {
243
            int style = Util.getStyle(dateStyle, "FORMAT_DATE_INVALID_DATE_STYLE");
206
		if ((type == null) || DATE.equalsIgnoreCase(type)) {
244
            String key = DATE + style + loc;
207
		    String key = DATE + pattern + loc;
208
            formatter = (DateFormat) dateFormatCache.get(key);
245
            formatter = (DateFormat) dateFormatCache.get(key);
209
            if(formatter == null) {
246
            if (formatter == null) {
210
                formatter = new SimpleDateFormat(pattern, loc);
247
                formatter = DateFormat.getDateInstance(style, loc);
211
                dateFormatCache.put(key, formatter);
248
                dateFormatCache.put(key, formatter);
212
            }
249
            }
213
		} else if (TIME.equalsIgnoreCase(type)) {
250
        } else if (TIME.equalsIgnoreCase(type)) {
214
		    String key = TIME + pattern + loc;
251
            int style = Util.getStyle(timeStyle, "FORMAT_DATE_INVALID_TIME_STYLE");
252
            String key = TIME + style + loc;
215
            formatter = (DateFormat) dateFormatCache.get(key);
253
            formatter = (DateFormat) dateFormatCache.get(key);
216
            if(formatter == null) {
254
            if (formatter == null) {
217
                formatter = new SimpleDateFormat(pattern, loc);
255
                formatter = DateFormat.getTimeInstance(style, loc);
218
                dateFormatCache.put(key, formatter);
256
                dateFormatCache.put(key, formatter);
219
            }
257
            }
220
		} else if (DATETIME.equalsIgnoreCase(type)) {
258
        } else if (DATETIME.equalsIgnoreCase(type)) {
221
		    String key = DATETIME + pattern + loc;
259
            int style1 = Util.getStyle(dateStyle, "FORMAT_DATE_INVALID_DATE_STYLE");
260
            int style2 = Util.getStyle(timeStyle, "FORMAT_DATE_INVALID_TIME_STYLE");
261
            String key = DATETIME + style1 + loc + style2;
222
            formatter = (DateFormat) dateFormatCache.get(key);
262
            formatter = (DateFormat) dateFormatCache.get(key);
223
            if(formatter == null) {
263
            if (formatter == null) {
224
                formatter = new SimpleDateFormat(pattern, loc);
264
                formatter = DateFormat.getDateTimeInstance(style1, style2, loc);
225
                dateFormatCache.put(key, formatter);
265
                dateFormatCache.put(key, formatter);
226
            }
266
            }
227
		} else {
267
        } else {
228
		    throw new JspException(
268
            throw new JspException(
229
  	                  Resources.getMessage("FORMAT_DATE_INVALID_TYPE", 
269
                    Resources.getMessage("FORMAT_DATE_INVALID_TYPE",
230
						 type));
270
                            type));
231
		}
271
        }
272
232
        return formatter;
273
        return formatter;
233
	}
234
235
	if ((type == null) || DATE.equalsIgnoreCase(type)) {
236
		int style = Util.getStyle(dateStyle, "FORMAT_DATE_INVALID_DATE_STYLE");
237
		String key = DATE + style + loc;
238
		formatter = (DateFormat) dateFormatCache.get(key);
239
		if(formatter == null) {
240
			formatter = DateFormat.getDateInstance(style, loc);
241
			dateFormatCache.put(key, formatter);
242
		}
243
	} else if (TIME.equalsIgnoreCase(type)) {
244
		int style = Util.getStyle(timeStyle, "FORMAT_DATE_INVALID_TIME_STYLE");
245
		String key = TIME + style + loc;
246
		formatter = (DateFormat) dateFormatCache.get(key);
247
		if(formatter == null) {
248
			formatter = DateFormat.getTimeInstance(style, loc);
249
			dateFormatCache.put(key, formatter);
250
		}
251
	} else if (DATETIME.equalsIgnoreCase(type)) {
252
		int style1 = Util.getStyle(dateStyle, "FORMAT_DATE_INVALID_DATE_STYLE");
253
		int style2 = Util.getStyle(timeStyle, "FORMAT_DATE_INVALID_TIME_STYLE");
254
		String key = DATETIME + style1 + loc + style2;
255
		formatter = (DateFormat) dateFormatCache.get(key);
256
		if(formatter == null) {
257
			formatter = DateFormat.getDateTimeInstance(style1, style2, loc);
258
			dateFormatCache.put(key, formatter);
259
		}
260
	} else {
261
	    throw new JspException(
262
                    Resources.getMessage("FORMAT_DATE_INVALID_TYPE", 
263
					 type));
264
	}
265
266
	return formatter;
267
    }
274
    }
268
}
275
}
(-)src/main/java/org/apache/taglibs/standard/tag/common/fmt/SetTimeZoneSupport.java (-27 / +29 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tag.common.fmt;
18
package org.apache.taglibs.standard.tag.common.fmt;
19
19
Lines 35-41 Link Here
35
35
36
public abstract class SetTimeZoneSupport extends TagSupport {
36
public abstract class SetTimeZoneSupport extends TagSupport {
37
37
38
    
38
39
    //*********************************************************************
39
    //*********************************************************************
40
    // Protected state
40
    // Protected state
41
41
Lines 53-74 Link Here
53
    // Constructor and initialization
53
    // Constructor and initialization
54
54
55
    public SetTimeZoneSupport() {
55
    public SetTimeZoneSupport() {
56
	super();
56
        super();
57
	init();
57
        init();
58
    }
58
    }
59
59
60
    // resets local state
60
    // resets local state
61
61
    private void init() {
62
    private void init() {
62
	value = var = null;
63
        value = var = null;
63
	scope = PageContext.PAGE_SCOPE;
64
        scope = PageContext.PAGE_SCOPE;
64
    }
65
    }
65
66
66
67
67
   //*********************************************************************
68
    //*********************************************************************
68
    // Tag attributes known at translation time
69
    // Tag attributes known at translation time
69
70
70
    public void setScope(String scope) {
71
    public void setScope(String scope) {
71
	this.scope = Util.getScope(scope);
72
        this.scope = Util.getScope(scope);
72
    }
73
    }
73
74
74
    public void setVar(String var) {
75
    public void setVar(String var) {
Lines 81-112 Link Here
81
82
82
    @Override
83
    @Override
83
    public int doEndTag() throws JspException {
84
    public int doEndTag() throws JspException {
84
	TimeZone timeZone = null;
85
        TimeZone timeZone = null;
85
86
86
	if (value == null) {
87
        if (value == null) {
87
	    timeZone = TimeZone.getTimeZone("GMT");
88
            timeZone = TimeZone.getTimeZone("GMT");
88
	} else if (value instanceof String) {
89
        } else if (value instanceof String) {
89
	    if (((String) value).trim().equals("")) {
90
            if (((String) value).trim().equals("")) {
90
		timeZone = TimeZone.getTimeZone("GMT");
91
                timeZone = TimeZone.getTimeZone("GMT");
91
	    } else {
92
            } else {
92
		timeZone = TimeZone.getTimeZone((String) value);
93
                timeZone = TimeZone.getTimeZone((String) value);
93
	    }
94
            }
94
	} else {
95
        } else {
95
	    timeZone = (TimeZone) value;
96
            timeZone = (TimeZone) value;
96
	}
97
        }
97
98
98
	if (var != null) {
99
        if (var != null) {
99
	    pageContext.setAttribute(var, timeZone, scope);
100
            pageContext.setAttribute(var, timeZone, scope);
100
	} else {
101
        } else {
101
	    Config.set(pageContext, Config.FMT_TIME_ZONE, timeZone, scope);
102
            Config.set(pageContext, Config.FMT_TIME_ZONE, timeZone, scope);
102
	}
103
        }
103
104
104
	return EVAL_PAGE;
105
        return EVAL_PAGE;
105
    }
106
    }
106
107
107
    // Releases any resources we may have (or inherit)
108
    // Releases any resources we may have (or inherit)
109
108
    @Override
110
    @Override
109
    public void release() {
111
    public void release() {
110
	init();
112
        init();
111
    }
113
    }
112
}
114
}
(-)src/main/java/org/apache/taglibs/standard/tag/common/fmt/ParseDateSupport.java (-108 / +111 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tag.common.fmt;
18
package org.apache.taglibs.standard.tag.common.fmt;
19
19
Lines 54-60 Link Here
54
    // Protected state
54
    // Protected state
55
55
56
    protected String value;                      // 'value' attribute
56
    protected String value;                      // 'value' attribute
57
    protected boolean valueSpecified;	         // status
57
    protected boolean valueSpecified;             // status
58
    protected String type;                       // 'type' attribute
58
    protected String type;                       // 'type' attribute
59
    protected String pattern;                    // 'pattern' attribute
59
    protected String pattern;                    // 'pattern' attribute
60
    protected Object timeZone;                   // 'timeZone' attribute
60
    protected Object timeZone;                   // 'timeZone' attribute
Lines 74-94 Link Here
74
    // Constructor and initialization
74
    // Constructor and initialization
75
75
76
    public ParseDateSupport() {
76
    public ParseDateSupport() {
77
	super();
77
        super();
78
	init();
78
        init();
79
    }
79
    }
80
80
81
    private void init() {
81
    private void init() {
82
	type = dateStyle = timeStyle = null;
82
        type = dateStyle = timeStyle = null;
83
	value = pattern = var = null;
83
        value = pattern = var = null;
84
	valueSpecified = false;
84
        valueSpecified = false;
85
	timeZone = null;
85
        timeZone = null;
86
	scope = PageContext.PAGE_SCOPE;
86
        scope = PageContext.PAGE_SCOPE;
87
	parseLocale = null;
87
        parseLocale = null;
88
    }
88
    }
89
89
90
90
91
   //*********************************************************************
91
    //*********************************************************************
92
    // Tag attributes known at translation time
92
    // Tag attributes known at translation time
93
93
94
    public void setVar(String var) {
94
    public void setVar(String var) {
Lines 96-102 Link Here
96
    }
96
    }
97
97
98
    public void setScope(String scope) {
98
    public void setScope(String scope) {
99
	this.scope = Util.getScope(scope);
99
        this.scope = Util.getScope(scope);
100
    }
100
    }
101
101
102
102
Lines 110-206 Link Here
110
110
111
        // determine the input by...
111
        // determine the input by...
112
        if (valueSpecified) {
112
        if (valueSpecified) {
113
	    // ... reading 'value' attribute
113
            // ... reading 'value' attribute
114
	    input = value;
114
            input = value;
115
	} else {
115
        } else {
116
	    // ... retrieving and trimming our body
116
            // ... retrieving and trimming our body
117
	    if (bodyContent != null && bodyContent.getString() != null)
117
            if (bodyContent != null && bodyContent.getString() != null) {
118
	        input = bodyContent.getString().trim();
118
                input = bodyContent.getString().trim();
119
	}
119
            }
120
        }
120
121
121
	if ((input == null) || input.equals("")) {
122
        if ((input == null) || input.equals("")) {
122
	    if (var != null) {
123
            if (var != null) {
123
		pageContext.removeAttribute(var, scope);
124
                pageContext.removeAttribute(var, scope);
124
	    }
125
            }
125
	    return EVAL_PAGE;
126
            return EVAL_PAGE;
126
	}
127
        }
127
128
128
	/*
129
        /*
129
	 * Set up parsing locale: Use locale specified via the 'parseLocale'
130
       * Set up parsing locale: Use locale specified via the 'parseLocale'
130
	 * attribute (if present), or else determine page's locale.
131
       * attribute (if present), or else determine page's locale.
131
	 */
132
       */
132
	Locale locale = parseLocale;
133
        Locale locale = parseLocale;
133
	if (locale == null)
134
        if (locale == null) {
134
	    locale = SetLocaleSupport.getFormattingLocale(
135
            locale = SetLocaleSupport.getFormattingLocale(
135
                pageContext,
136
                    pageContext,
136
	        this,
137
                    this,
137
		false,
138
                    false,
138
	        DateFormat.getAvailableLocales());
139
                    DateFormat.getAvailableLocales());
139
	if (locale == null) {
140
        }
140
	    throw new JspException(
141
        if (locale == null) {
142
            throw new JspException(
141
                    Resources.getMessage("PARSE_DATE_NO_PARSE_LOCALE"));
143
                    Resources.getMessage("PARSE_DATE_NO_PARSE_LOCALE"));
142
	}
144
        }
143
145
144
	// Create parser
146
        // Create parser
145
	DateFormat parser = createParser(locale);
147
        DateFormat parser = createParser(locale);
146
148
147
	// Apply pattern, if present
149
        // Apply pattern, if present
148
	if (pattern != null) {
150
        if (pattern != null) {
149
	    try {
151
            try {
150
		((SimpleDateFormat) parser).applyPattern(pattern);
152
                ((SimpleDateFormat) parser).applyPattern(pattern);
151
	    } catch (ClassCastException cce) {
153
            } catch (ClassCastException cce) {
152
		parser = new SimpleDateFormat(pattern, locale);
154
                parser = new SimpleDateFormat(pattern, locale);
153
	    }
155
            }
154
	}
156
        }
155
157
156
	// Set time zone
158
        // Set time zone
157
	TimeZone tz = null;
159
        TimeZone tz = null;
158
	if ((timeZone instanceof String) && ((String) timeZone).equals("")) {
160
        if ((timeZone instanceof String) && ((String) timeZone).equals("")) {
159
	    timeZone = null;
161
            timeZone = null;
160
	}
162
        }
161
	if (timeZone != null) {
163
        if (timeZone != null) {
162
	    if (timeZone instanceof String) {
164
            if (timeZone instanceof String) {
163
		tz = TimeZone.getTimeZone((String) timeZone);
165
                tz = TimeZone.getTimeZone((String) timeZone);
164
	    } else if (timeZone instanceof TimeZone) {
166
            } else if (timeZone instanceof TimeZone) {
165
		tz = (TimeZone) timeZone;
167
                tz = (TimeZone) timeZone;
166
	    } else {
168
            } else {
167
		throw new JspException(
169
                throw new JspException(
168
                    Resources.getMessage("PARSE_DATE_BAD_TIMEZONE"));
170
                        Resources.getMessage("PARSE_DATE_BAD_TIMEZONE"));
169
	    }
171
            }
170
	} else {
172
        } else {
171
	    tz = TimeZoneSupport.getTimeZone(pageContext, this);
173
            tz = TimeZoneSupport.getTimeZone(pageContext, this);
172
	}
174
        }
173
	if (tz != null) {
175
        if (tz != null) {
174
	    parser.setTimeZone(tz);
176
            parser.setTimeZone(tz);
175
	}
177
        }
176
178
177
	// Parse date
179
        // Parse date
178
	Date parsed = null;
180
        Date parsed = null;
179
	try {
181
        try {
180
	    parsed = parser.parse(input);
182
            parsed = parser.parse(input);
181
	} catch (ParseException pe) {
183
        } catch (ParseException pe) {
182
	    throw new JspException(
184
            throw new JspException(
183
	            Resources.getMessage("PARSE_DATE_PARSE_ERROR", input),
185
                    Resources.getMessage("PARSE_DATE_PARSE_ERROR", input),
184
		    pe);
186
                    pe);
185
	}
187
        }
186
188
187
	if (var != null) {
189
        if (var != null) {
188
	    pageContext.setAttribute(var, parsed, scope);	
190
            pageContext.setAttribute(var, parsed, scope);
189
	} else {
191
        } else {
190
	    try {
192
            try {
191
		pageContext.getOut().print(parsed);
193
                pageContext.getOut().print(parsed);
192
	    } catch (IOException ioe) {
194
            } catch (IOException ioe) {
193
		throw new JspTagException(ioe.toString(), ioe);
195
                throw new JspTagException(ioe.toString(), ioe);
194
	    }
196
            }
195
	}
197
        }
196
198
197
	return EVAL_PAGE;
199
        return EVAL_PAGE;
198
    }
200
    }
199
201
200
    // Releases any resources we may have (or inherit)
202
    // Releases any resources we may have (or inherit)
203
201
    @Override
204
    @Override
202
    public void release() {
205
    public void release() {
203
	init();
206
        init();
204
    }
207
    }
205
208
206
209
Lines 208-235 Link Here
208
    // Private utility methods
211
    // Private utility methods
209
212
210
    private DateFormat createParser(Locale loc) throws JspException {
213
    private DateFormat createParser(Locale loc) throws JspException {
211
	DateFormat parser = null;
214
        DateFormat parser = null;
212
215
213
	if ((type == null) || DATE.equalsIgnoreCase(type)) {
216
        if ((type == null) || DATE.equalsIgnoreCase(type)) {
214
	    parser = DateFormat.getDateInstance(
217
            parser = DateFormat.getDateInstance(
215
	        Util.getStyle(dateStyle, "PARSE_DATE_INVALID_DATE_STYLE"),
218
                    Util.getStyle(dateStyle, "PARSE_DATE_INVALID_DATE_STYLE"),
216
		loc);
219
                    loc);
217
	} else if (TIME.equalsIgnoreCase(type)) {
220
        } else if (TIME.equalsIgnoreCase(type)) {
218
	    parser = DateFormat.getTimeInstance(
221
            parser = DateFormat.getTimeInstance(
219
	        Util.getStyle(timeStyle, "PARSE_DATE_INVALID_TIME_STYLE"),
222
                    Util.getStyle(timeStyle, "PARSE_DATE_INVALID_TIME_STYLE"),
220
		loc);
223
                    loc);
221
	} else if (DATETIME.equalsIgnoreCase(type)) {
224
        } else if (DATETIME.equalsIgnoreCase(type)) {
222
	    parser = DateFormat.getDateTimeInstance(
225
            parser = DateFormat.getDateTimeInstance(
223
	        Util.getStyle(dateStyle, "PARSE_DATE_INVALID_DATE_STYLE"),
226
                    Util.getStyle(dateStyle, "PARSE_DATE_INVALID_DATE_STYLE"),
224
		Util.getStyle(timeStyle, "PARSE_DATE_INVALID_TIME_STYLE"),
227
                    Util.getStyle(timeStyle, "PARSE_DATE_INVALID_TIME_STYLE"),
225
		loc);
228
                    loc);
226
	} else {
229
        } else {
227
	    throw new JspException(
230
            throw new JspException(
228
                    Resources.getMessage("PARSE_DATE_INVALID_TYPE", type));
231
                    Resources.getMessage("PARSE_DATE_INVALID_TYPE", type));
229
	}
232
        }
230
233
231
	parser.setLenient(false);
234
        parser.setLenient(false);
232
235
233
	return parser;
236
        return parser;
234
    }
237
    }
235
}
238
}
(-)src/main/java/org/apache/taglibs/standard/tag/common/fmt/BundleSupport.java (-156 / +161 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tag.common.fmt;
18
package org.apache.taglibs.standard.tag.common.fmt;
19
19
Lines 41-48 Link Here
41
 */
41
 */
42
42
43
public abstract class BundleSupport extends BodyTagSupport {
43
public abstract class BundleSupport extends BodyTagSupport {
44
    
45
44
45
46
    //*********************************************************************
46
    //*********************************************************************
47
    // Private constants
47
    // Private constants
48
48
Lines 67-91 Link Here
67
    // Constructor and initialization
67
    // Constructor and initialization
68
68
69
    public BundleSupport() {
69
    public BundleSupport() {
70
	super();
70
        super();
71
	init();
71
        init();
72
    }
72
    }
73
73
74
    private void init() {
74
    private void init() {
75
	basename = prefix = null;
75
        basename = prefix = null;
76
	locCtxt = null;
76
        locCtxt = null;
77
    }
77
    }
78
78
79
    
79
80
    //*********************************************************************
80
    //*********************************************************************
81
    // Collaboration with subtags
81
    // Collaboration with subtags
82
82
83
    public LocalizationContext getLocalizationContext() {
83
    public LocalizationContext getLocalizationContext() {
84
	return locCtxt;
84
        return locCtxt;
85
    }
85
    }
86
86
87
    public String getPrefix() {
87
    public String getPrefix() {
88
	return prefix;
88
        return prefix;
89
    }
89
    }
90
90
91
91
Lines 94-121 Link Here
94
94
95
    @Override
95
    @Override
96
    public int doStartTag() throws JspException {
96
    public int doStartTag() throws JspException {
97
	locCtxt = getLocalizationContext(pageContext, basename);
97
        locCtxt = getLocalizationContext(pageContext, basename);
98
	return EVAL_BODY_BUFFERED;
98
        return EVAL_BODY_BUFFERED;
99
    }
99
    }
100
100
101
    @Override
101
    @Override
102
    public int doEndTag() throws JspException {
102
    public int doEndTag() throws JspException {
103
	if (bodyContent != null) {
103
        if (bodyContent != null) {
104
	    try {
104
            try {
105
		pageContext.getOut().print(bodyContent.getString());
105
                pageContext.getOut().print(bodyContent.getString());
106
	    } catch (IOException ioe) {
106
            } catch (IOException ioe) {
107
		throw new JspTagException(ioe.toString(), ioe);
107
                throw new JspTagException(ioe.toString(), ioe);
108
	    }
108
            }
109
	}
109
        }
110
110
111
	return EVAL_PAGE;
111
        return EVAL_PAGE;
112
    }
112
    }
113
113
114
    // Releases any resources we may have (or inherit)
114
    // Releases any resources we may have (or inherit)
115
115
    @Override
116
    @Override
116
    public void release() {
117
    public void release() {
117
        super.release();
118
        super.release();
118
    	init();
119
        init();
119
    }
120
    }
120
121
121
122
Lines 126-267 Link Here
126
     * Gets the default I18N localization context.
127
     * Gets the default I18N localization context.
127
     *
128
     *
128
     * @param pc Page in which to look up the default I18N localization context
129
     * @param pc Page in which to look up the default I18N localization context
129
     */    
130
     */
130
    public static LocalizationContext getLocalizationContext(PageContext pc) {
131
    public static LocalizationContext getLocalizationContext(PageContext pc) {
131
	LocalizationContext locCtxt = null;
132
        LocalizationContext locCtxt = null;
132
133
133
	Object obj = Config.find(pc, Config.FMT_LOCALIZATION_CONTEXT);
134
        Object obj = Config.find(pc, Config.FMT_LOCALIZATION_CONTEXT);
134
	if (obj == null) {
135
        if (obj == null) {
135
	    return null;
136
            return null;
136
	}
137
        }
137
138
138
	if (obj instanceof LocalizationContext) {
139
        if (obj instanceof LocalizationContext) {
139
	    locCtxt = (LocalizationContext) obj;
140
            locCtxt = (LocalizationContext) obj;
140
	} else {
141
        } else {
141
	    // localization context is a bundle basename
142
            // localization context is a bundle basename
142
	    locCtxt = getLocalizationContext(pc, (String) obj);
143
            locCtxt = getLocalizationContext(pc, (String) obj);
143
	}
144
        }
144
145
145
	return locCtxt;
146
        return locCtxt;
146
    }
147
    }
147
148
148
    /**
149
    /**
149
     * Gets the resource bundle with the given base name, whose locale is
150
     * Gets the resource bundle with the given base name, whose locale is
150
     * determined as follows:
151
     * determined as follows:
151
     *
152
     * <p/>
152
     * Check if a match exists between the ordered set of preferred
153
     * Check if a match exists between the ordered set of preferred
153
     * locales and the available locales, for the given base name.
154
     * locales and the available locales, for the given base name.
154
     * The set of preferred locales consists of a single locale
155
     * The set of preferred locales consists of a single locale
155
     * (if the <tt>javax.servlet.jsp.jstl.fmt.locale</tt> configuration
156
     * (if the <tt>javax.servlet.jsp.jstl.fmt.locale</tt> configuration
156
     * setting is present) or is equal to the client's preferred locales
157
     * setting is present) or is equal to the client's preferred locales
157
     * determined from the client's browser settings.
158
     * determined from the client's browser settings.
158
     *
159
     * <p/>
159
     * <p> If no match was found in the previous step, check if a match
160
     * <p> If no match was found in the previous step, check if a match
160
     * exists between the fallback locale (given by the
161
     * exists between the fallback locale (given by the
161
     * <tt>javax.servlet.jsp.jstl.fmt.fallbackLocale</tt> configuration
162
     * <tt>javax.servlet.jsp.jstl.fmt.fallbackLocale</tt> configuration
162
     * setting) and the available locales, for the given base name.
163
     * setting) and the available locales, for the given base name.
163
     *
164
     *
164
     * @param pc Page in which the resource bundle with the
165
     * @param pc       Page in which the resource bundle with the
165
     * given base name is requested
166
     *                 given base name is requested
166
     * @param basename Resource bundle base name
167
     * @param basename Resource bundle base name
167
     *
168
     * @return Localization context containing the resource bundle with the
168
     * @return Localization context containing the resource bundle with the
169
     * given base name and the locale that led to the resource bundle match,
169
     *         given base name and the locale that led to the resource bundle match,
170
     * or the empty localization context if no resource bundle match was found
170
     *         or the empty localization context if no resource bundle match was found
171
     */
171
     */
172
    public static LocalizationContext getLocalizationContext(PageContext pc,
172
    public static LocalizationContext getLocalizationContext(PageContext pc,
173
							     String basename) {
173
                                                             String basename) {
174
	LocalizationContext locCtxt = null;
174
        LocalizationContext locCtxt = null;
175
	ResourceBundle bundle = null;
175
        ResourceBundle bundle = null;
176
176
177
	if ((basename == null) || basename.equals("")) {
177
        if ((basename == null) || basename.equals("")) {
178
	    return new LocalizationContext();
178
            return new LocalizationContext();
179
	}
179
        }
180
180
181
	// Try preferred locales
181
        // Try preferred locales
182
	Locale pref = SetLocaleSupport.getLocale(pc, Config.FMT_LOCALE);
182
        Locale pref = SetLocaleSupport.getLocale(pc, Config.FMT_LOCALE);
183
	if (pref != null) {
183
        if (pref != null) {
184
	    // Preferred locale is application-based
184
            // Preferred locale is application-based
185
	    bundle = findMatch(basename, pref);
185
            bundle = findMatch(basename, pref);
186
	    if (bundle != null) {
186
            if (bundle != null) {
187
		locCtxt = new LocalizationContext(bundle, pref);
187
                locCtxt = new LocalizationContext(bundle, pref);
188
	    }
188
            }
189
	} else {
189
        } else {
190
	    // Preferred locales are browser-based
190
            // Preferred locales are browser-based
191
	    locCtxt = findMatch(pc, basename);
191
            locCtxt = findMatch(pc, basename);
192
	}
192
        }
193
	
194
	if (locCtxt == null) {
195
	    // No match found with preferred locales, try using fallback locale
196
	    pref = SetLocaleSupport.getLocale(pc, Config.FMT_FALLBACK_LOCALE);
197
	    if (pref != null) {
198
		bundle = findMatch(basename, pref);
199
		if (bundle != null) {
200
		    locCtxt = new LocalizationContext(bundle, pref);
201
		}
202
	    }
203
	}
204
193
205
	if (locCtxt == null) {
194
        if (locCtxt == null) {
206
	    // try using the root resource bundle with the given basename
195
            // No match found with preferred locales, try using fallback locale
207
	    try {
196
            pref = SetLocaleSupport.getLocale(pc, Config.FMT_FALLBACK_LOCALE);
208
	        ClassLoader cl = getClassLoaderCheckingPrivilege();
197
            if (pref != null) {
209
            bundle = ResourceBundle.getBundle(basename, EMPTY_LOCALE, cl);
198
                bundle = findMatch(basename, pref);
210
		if (bundle != null) {
199
                if (bundle != null) {
211
		    locCtxt = new LocalizationContext(bundle, null);
200
                    locCtxt = new LocalizationContext(bundle, pref);
212
		}
201
                }
213
	    } catch (MissingResourceException mre) {
202
            }
214
		// do nothing
203
        }
215
	    }
216
	}
217
		 
218
	if (locCtxt != null) {
219
	    // set response locale
220
	    if (locCtxt.getLocale() != null) {
221
		SetLocaleSupport.setResponseLocale(pc, locCtxt.getLocale());
222
	    }
223
	} else {
224
	    // create empty localization context
225
	    locCtxt = new LocalizationContext();
226
	}
227
204
228
	return locCtxt;
205
        if (locCtxt == null) {
206
            // try using the root resource bundle with the given basename
207
            try {
208
                ClassLoader cl = getClassLoaderCheckingPrivilege();
209
                bundle = ResourceBundle.getBundle(basename, EMPTY_LOCALE, cl);
210
                if (bundle != null) {
211
                    locCtxt = new LocalizationContext(bundle, null);
212
                }
213
            } catch (MissingResourceException mre) {
214
                // do nothing
215
            }
216
        }
217
218
        if (locCtxt != null) {
219
            // set response locale
220
            if (locCtxt.getLocale() != null) {
221
                SetLocaleSupport.setResponseLocale(pc, locCtxt.getLocale());
222
            }
223
        } else {
224
            // create empty localization context
225
            locCtxt = new LocalizationContext();
226
        }
227
228
        return locCtxt;
229
    }
229
    }
230
230
231
231
232
    //*********************************************************************
232
    //*********************************************************************
233
    // Private utility methods
233
    // Private utility methods
234
    
234
235
    /*
235
    /*
236
     * Determines the client's preferred locales from the request, and compares
236
    * Determines the client's preferred locales from the request, and compares
237
     * each of the locales (in order of preference) against the available
237
    * each of the locales (in order of preference) against the available
238
     * locales in order to determine the best matching locale.
238
    * locales in order to determine the best matching locale.
239
     *
239
    *
240
     * @param pageContext the page in which the resource bundle with the
240
    * @param pageContext the page in which the resource bundle with the
241
     * given base name is requested
241
    * given base name is requested
242
     * @param basename the resource bundle's base name
242
    * @param basename the resource bundle's base name
243
     *
243
    *
244
     * @return the localization context containing the resource bundle with
244
    * @return the localization context containing the resource bundle with
245
     * the given base name and best matching locale, or <tt>null</tt> if no
245
    * the given base name and best matching locale, or <tt>null</tt> if no
246
     * resource bundle match was found
246
    * resource bundle match was found
247
     */
247
    */
248
248
    private static LocalizationContext findMatch(PageContext pageContext,
249
    private static LocalizationContext findMatch(PageContext pageContext,
249
						 String basename) {
250
                                                 String basename) {
250
	LocalizationContext locCtxt = null;
251
        LocalizationContext locCtxt = null;
251
	
252
252
	// Determine locale from client's browser settings.
253
        // Determine locale from client's browser settings.
253
        
254
254
	for (Enumeration enum_ = Util.getRequestLocales((HttpServletRequest)pageContext.getRequest());
255
        for (Enumeration enum_ = Util.getRequestLocales((HttpServletRequest) pageContext.getRequest());
255
	     enum_.hasMoreElements(); ) {
256
             enum_.hasMoreElements();) {
256
	    Locale pref = (Locale) enum_.nextElement();
257
            Locale pref = (Locale) enum_.nextElement();
257
	    ResourceBundle match = findMatch(basename, pref);
258
            ResourceBundle match = findMatch(basename, pref);
258
	    if (match != null) {
259
            if (match != null) {
259
		locCtxt = new LocalizationContext(match, pref);
260
                locCtxt = new LocalizationContext(match, pref);
260
		break;
261
                break;
261
	    }
262
            }
262
	}
263
        }
263
        	
264
264
	return locCtxt;
265
        return locCtxt;
265
    }
266
    }
266
267
267
    /*
268
    /*
Lines 279-295 Link Here
279
     * language-match between the preferred locale and the locale of
280
     * language-match between the preferred locale and the locale of
280
     * the bundle returned by java.util.ResourceBundle.getBundle().
281
     * the bundle returned by java.util.ResourceBundle.getBundle().
281
     */
282
     */
283
282
    private static ResourceBundle findMatch(String basename, Locale pref) {
284
    private static ResourceBundle findMatch(String basename, Locale pref) {
283
	ResourceBundle match = null;
285
        ResourceBundle match = null;
284
286
285
	try {
287
        try {
286
	    ClassLoader cl = getClassLoaderCheckingPrivilege();
288
            ClassLoader cl = getClassLoaderCheckingPrivilege();
287
        ResourceBundle bundle = ResourceBundle.getBundle(basename, pref, cl);
289
            ResourceBundle bundle = ResourceBundle.getBundle(basename, pref, cl);
288
	    Locale avail = bundle.getLocale();
290
            Locale avail = bundle.getLocale();
289
	    if (pref.equals(avail)) {
291
            if (pref.equals(avail)) {
290
		// Exact match
292
                // Exact match
291
		match = bundle;
293
                match = bundle;
292
	    } else {
294
            } else {
293
                /*
295
                /*
294
                 * We have to make sure that the match we got is for
296
                 * We have to make sure that the match we got is for
295
                 * the specified locale. The way ResourceBundle.getBundle()
297
                 * the specified locale. The way ResourceBundle.getBundle()
Lines 303-335 Link Here
303
                 *     - avail locale must be equal to preferred locale
305
                 *     - avail locale must be equal to preferred locale
304
                 *     - avail country must be empty or equal to preferred country
306
                 *     - avail country must be empty or equal to preferred country
305
                 *       (the equality match might have failed on the variant)
307
                 *       (the equality match might have failed on the variant)
306
		 */
308
                 */
307
                if (pref.getLanguage().equals(avail.getLanguage())
309
                if (pref.getLanguage().equals(avail.getLanguage())
308
		    && ("".equals(avail.getCountry()) || pref.getCountry().equals(avail.getCountry()))) {
310
                        && ("".equals(avail.getCountry()) || pref.getCountry().equals(avail.getCountry()))) {
309
		    /*
311
                    /*
310
		     * Language match.
312
                  * Language match.
311
		     * By making sure the available locale does not have a 
313
                  * By making sure the available locale does not have a
312
		     * country and matches the preferred locale's language, we
314
                  * country and matches the preferred locale's language, we
313
		     * rule out "matches" based on the container's default
315
                  * rule out "matches" based on the container's default
314
		     * locale. For example, if the preferred locale is 
316
                  * locale. For example, if the preferred locale is
315
		     * "en-US", the container's default locale is "en-UK", and
317
                  * "en-US", the container's default locale is "en-UK", and
316
		     * there is a resource bundle (with the requested base
318
                  * there is a resource bundle (with the requested base
317
		     * name) available for "en-UK", ResourceBundle.getBundle()
319
                  * name) available for "en-UK", ResourceBundle.getBundle()
318
		     * will return it, but even though its language matches
320
                  * will return it, but even though its language matches
319
		     * that of the preferred locale, we must ignore it,
321
                  * that of the preferred locale, we must ignore it,
320
		     * because matches based on the container's default locale
322
                  * because matches based on the container's default locale
321
		     * are not portable across different containers with
323
                  * are not portable across different containers with
322
		     * different default locales.
324
                  * different default locales.
323
		     */
325
                  */
324
		    match = bundle;
326
                    match = bundle;
325
		}
327
                }
326
	    }
328
            }
327
	} catch (MissingResourceException mre) {
329
        } catch (MissingResourceException mre) {
328
	}
330
        }
329
331
330
	return match;
332
        return match;
331
    }
333
    }
332
    
334
333
    private static ClassLoader getClassLoaderCheckingPrivilege() {
335
    private static ClassLoader getClassLoaderCheckingPrivilege() {
334
        ClassLoader cl;
336
        ClassLoader cl;
335
        SecurityManager sm = System.getSecurityManager();
337
        SecurityManager sm = System.getSecurityManager();
Lines 337-344 Link Here
337
            cl = Thread.currentThread().getContextClassLoader();
339
            cl = Thread.currentThread().getContextClassLoader();
338
        } else {
340
        } else {
339
            cl = java.security.AccessController.doPrivileged(
341
            cl = java.security.AccessController.doPrivileged(
340
                new java.security.PrivilegedAction<ClassLoader>() 
342
                    new java.security.PrivilegedAction<ClassLoader>() {
341
                {public ClassLoader run() {return Thread.currentThread().getContextClassLoader();}});
343
                        public ClassLoader run() {
344
                            return Thread.currentThread().getContextClassLoader();
345
                        }
346
                    });
342
        }
347
        }
343
        return cl;
348
        return cl;
344
    }
349
    }
(-)src/main/java/org/apache/taglibs/standard/tag/common/fmt/TimeZoneSupport.java (-43 / +45 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tag.common.fmt;
18
package org.apache.taglibs.standard.tag.common.fmt;
19
19
Lines 41-48 Link Here
41
    // Protected state
41
    // Protected state
42
42
43
    protected Object value;                      // 'value' attribute
43
    protected Object value;                      // 'value' attribute
44
  
45
44
45
46
    //*********************************************************************
46
    //*********************************************************************
47
    // Private state
47
    // Private state
48
48
Lines 53-64 Link Here
53
    // Constructor and initialization
53
    // Constructor and initialization
54
54
55
    public TimeZoneSupport() {
55
    public TimeZoneSupport() {
56
	super();
56
        super();
57
	init();
57
        init();
58
    }
58
    }
59
59
60
    private void init() {
60
    private void init() {
61
	value = null;
61
        value = null;
62
    }
62
    }
63
63
64
64
Lines 66-72 Link Here
66
    // Collaboration with subtags
66
    // Collaboration with subtags
67
67
68
    public TimeZone getTimeZone() {
68
    public TimeZone getTimeZone() {
69
	return timeZone;
69
        return timeZone;
70
    }
70
    }
71
71
72
72
Lines 76-111 Link Here
76
    @Override
76
    @Override
77
    public int doStartTag() throws JspException {
77
    public int doStartTag() throws JspException {
78
78
79
	if (value == null) {
79
        if (value == null) {
80
	    timeZone = TimeZone.getTimeZone("GMT");
80
            timeZone = TimeZone.getTimeZone("GMT");
81
	} else if (value instanceof String) {
81
        } else if (value instanceof String) {
82
	    if (((String) value).trim().equals("")) {
82
            if (((String) value).trim().equals("")) {
83
		timeZone = TimeZone.getTimeZone("GMT");
83
                timeZone = TimeZone.getTimeZone("GMT");
84
	    } else {
84
            } else {
85
		timeZone = TimeZone.getTimeZone((String) value);
85
                timeZone = TimeZone.getTimeZone((String) value);
86
	    }
86
            }
87
	} else {
87
        } else {
88
	    timeZone = (TimeZone) value;
88
            timeZone = (TimeZone) value;
89
	}
89
        }
90
90
91
	return EVAL_BODY_BUFFERED;
91
        return EVAL_BODY_BUFFERED;
92
    }
92
    }
93
93
94
    @Override
94
    @Override
95
    public int doEndTag() throws JspException {
95
    public int doEndTag() throws JspException {
96
	try {
96
        try {
97
	    pageContext.getOut().print(bodyContent.getString());
97
            pageContext.getOut().print(bodyContent.getString());
98
	} catch (IOException ioe) {
98
        } catch (IOException ioe) {
99
	    throw new JspTagException(ioe.toString(), ioe);
99
            throw new JspTagException(ioe.toString(), ioe);
100
	}
100
        }
101
101
102
	return EVAL_PAGE;
102
        return EVAL_PAGE;
103
    }
103
    }
104
104
105
    // Releases any resources we may have (or inherit)
105
    // Releases any resources we may have (or inherit)
106
106
    @Override
107
    @Override
107
    public void release() {
108
    public void release() {
108
	init();
109
        init();
109
    }
110
    }
110
111
111
112
Lines 131-156 Link Here
131
     * nested inside a &lt;timeZone&gt; action and no time zone configuration
132
     * nested inside a &lt;timeZone&gt; action and no time zone configuration
132
     * setting exists
133
     * setting exists
133
     */
134
     */
135
134
    static TimeZone getTimeZone(PageContext pc, Tag fromTag) {
136
    static TimeZone getTimeZone(PageContext pc, Tag fromTag) {
135
	TimeZone tz = null;
137
        TimeZone tz = null;
136
138
137
	Tag t = findAncestorWithClass(fromTag, TimeZoneSupport.class);
139
        Tag t = findAncestorWithClass(fromTag, TimeZoneSupport.class);
138
	if (t != null) {
140
        if (t != null) {
139
	    // use time zone from parent <timeZone> tag
141
            // use time zone from parent <timeZone> tag
140
	    TimeZoneSupport parent = (TimeZoneSupport) t;
142
            TimeZoneSupport parent = (TimeZoneSupport) t;
141
	    tz = parent.getTimeZone();
143
            tz = parent.getTimeZone();
142
	} else {
144
        } else {
143
	    // get time zone from configuration setting
145
            // get time zone from configuration setting
144
	    Object obj = Config.find(pc, Config.FMT_TIME_ZONE);
146
            Object obj = Config.find(pc, Config.FMT_TIME_ZONE);
145
	    if (obj != null) {
147
            if (obj != null) {
146
		if (obj instanceof TimeZone) {
148
                if (obj instanceof TimeZone) {
147
		    tz = (TimeZone) obj;
149
                    tz = (TimeZone) obj;
148
		} else {
150
                } else {
149
		    tz = TimeZone.getTimeZone((String) obj);
151
                    tz = TimeZone.getTimeZone((String) obj);
150
		}
152
                }
151
	    }
153
            }
152
	}
154
        }
153
155
154
	return tz;
156
        return tz;
155
    }
157
    }
156
}
158
}
(-)src/main/java/org/apache/taglibs/standard/tag/common/fmt/SetLocaleSupport.java (-205 / +214 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tag.common.fmt;
18
package org.apache.taglibs.standard.tag.common.fmt;
19
19
Lines 44-50 Link Here
44
44
45
public abstract class SetLocaleSupport extends TagSupport {
45
public abstract class SetLocaleSupport extends TagSupport {
46
46
47
    
47
48
    //*********************************************************************
48
    //*********************************************************************
49
    // Private constants
49
    // Private constants
50
50
Lines 69-89 Link Here
69
    // Constructor and initialization
69
    // Constructor and initialization
70
70
71
    public SetLocaleSupport() {
71
    public SetLocaleSupport() {
72
	super();
72
        super();
73
	init();
73
        init();
74
    }
74
    }
75
75
76
    private void init() {
76
    private void init() {
77
	value = variant = null;
77
        value = variant = null;
78
	scope = PageContext.PAGE_SCOPE;
78
        scope = PageContext.PAGE_SCOPE;
79
    }
79
    }
80
80
81
81
82
   //*********************************************************************
82
    //*********************************************************************
83
    // Tag attributes known at translation time
83
    // Tag attributes known at translation time
84
84
85
    public void setScope(String scope) {
85
    public void setScope(String scope) {
86
	this.scope = Util.getScope(scope);
86
        this.scope = Util.getScope(scope);
87
    }
87
    }
88
88
89
89
Lines 92-121 Link Here
92
92
93
    @Override
93
    @Override
94
    public int doEndTag() throws JspException {
94
    public int doEndTag() throws JspException {
95
	Locale locale = null;
95
        Locale locale = null;
96
96
97
	if (value == null) {
97
        if (value == null) {
98
	    locale = Locale.getDefault();
98
            locale = Locale.getDefault();
99
	} else if (value instanceof String) {
99
        } else if (value instanceof String) {
100
	    if (((String) value).trim().equals("")) {
100
            if (((String) value).trim().equals("")) {
101
		locale = Locale.getDefault();
101
                locale = Locale.getDefault();
102
	    } else {
102
            } else {
103
		locale = parseLocale((String) value, variant);
103
                locale = parseLocale((String) value, variant);
104
	    }
104
            }
105
	} else {
105
        } else {
106
	    locale = (Locale) value;
106
            locale = (Locale) value;
107
	}
107
        }
108
108
109
	Config.set(pageContext, Config.FMT_LOCALE, locale, scope);
109
        Config.set(pageContext, Config.FMT_LOCALE, locale, scope);
110
	setResponseLocale(pageContext, locale);
110
        setResponseLocale(pageContext, locale);
111
111
112
	return EVAL_PAGE;
112
        return EVAL_PAGE;
113
    }
113
    }
114
114
115
    // Releases any resources we may have (or inherit)
115
    // Releases any resources we may have (or inherit)
116
116
    @Override
117
    @Override
117
    public void release() {
118
    public void release() {
118
	init();
119
        init();
119
    }
120
    }
120
121
121
122
Lines 126-186 Link Here
126
     * See parseLocale(String, String) for details.
127
     * See parseLocale(String, String) for details.
127
     */
128
     */
128
    public static Locale parseLocale(String locale) {
129
    public static Locale parseLocale(String locale) {
129
	return parseLocale(locale, null);
130
        return parseLocale(locale, null);
130
    }
131
    }
131
132
132
    /**
133
    /**
133
     * Parses the given locale string into its language and (optionally)
134
     * Parses the given locale string into its language and (optionally)
134
     * country components, and returns the corresponding
135
     * country components, and returns the corresponding
135
     * <tt>java.util.Locale</tt> object.
136
     * <tt>java.util.Locale</tt> object.
136
     *
137
     * <p/>
137
     * If the given locale string is null or empty, the runtime's default
138
     * If the given locale string is null or empty, the runtime's default
138
     * locale is returned.
139
     * locale is returned.
139
     *
140
     *
140
     * @param locale the locale string to parse
141
     * @param locale  the locale string to parse
141
     * @param variant the variant
142
     * @param variant the variant
142
     *
143
     * @return <tt>java.util.Locale</tt> object corresponding to the given
143
     * @return <tt>java.util.Locale</tt> object corresponding to the given
144
     * locale string, or the runtime's default locale if the locale string is
144
     *         locale string, or the runtime's default locale if the locale string is
145
     * null or empty
145
     *         null or empty
146
     *
147
     * @throws IllegalArgumentException if the given locale does not have a
146
     * @throws IllegalArgumentException if the given locale does not have a
148
     * language component or has an empty country component
147
     *                                  language component or has an empty country component
149
     */
148
     */
150
    public static Locale parseLocale(String locale, String variant) {
149
    public static Locale parseLocale(String locale, String variant) {
151
150
152
	Locale ret = null;
151
        Locale ret = null;
153
	String language = locale;
152
        String language = locale;
154
	String country = null;
153
        String country = null;
155
	int index = -1;
154
        int index = -1;
156
155
157
	if (((index = locale.indexOf(HYPHEN)) > -1)
156
        if (((index = locale.indexOf(HYPHEN)) > -1)
158
	        || ((index = locale.indexOf(UNDERSCORE)) > -1)) {
157
                || ((index = locale.indexOf(UNDERSCORE)) > -1)) {
159
	    language = locale.substring(0, index);
158
            language = locale.substring(0, index);
160
	    country = locale.substring(index+1);
159
            country = locale.substring(index + 1);
161
	}
160
        }
162
161
163
	if ((language == null) || (language.length() == 0)) {
162
        if ((language == null) || (language.length() == 0)) {
164
	    throw new IllegalArgumentException(
163
            throw new IllegalArgumentException(
165
		Resources.getMessage("LOCALE_NO_LANGUAGE"));
164
                    Resources.getMessage("LOCALE_NO_LANGUAGE"));
166
	}
165
        }
167
166
168
	if (country == null) {
167
        if (country == null) {
169
	    if (variant != null)
168
            if (variant != null) {
170
		ret = new Locale(language, "", variant);
169
                ret = new Locale(language, "", variant);
171
	    else
170
            } else {
172
		ret = new Locale(language, "");
171
                ret = new Locale(language, "");
173
	} else if (country.length() > 0) {
172
            }
174
	    if (variant != null)
173
        } else if (country.length() > 0) {
175
		ret = new Locale(language, country, variant);
174
            if (variant != null) {
176
	    else
175
                ret = new Locale(language, country, variant);
177
		ret = new Locale(language, country);
176
            } else {
178
	} else {
177
                ret = new Locale(language, country);
179
	    throw new IllegalArgumentException(
178
            }
180
		Resources.getMessage("LOCALE_EMPTY_COUNTRY"));
179
        } else {
181
	}
180
            throw new IllegalArgumentException(
181
                    Resources.getMessage("LOCALE_EMPTY_COUNTRY"));
182
        }
182
183
183
	return ret;
184
        return ret;
184
    }
185
    }
185
186
186
187
Lines 201-295 Link Here
201
     * the given locale
202
     * the given locale
202
     * @param locale the response locale
203
     * @param locale the response locale
203
     */
204
     */
205
204
    static void setResponseLocale(PageContext pc, Locale locale) {
206
    static void setResponseLocale(PageContext pc, Locale locale) {
205
	// set response locale
207
        // set response locale
206
	ServletResponse response = pc.getResponse();
208
        ServletResponse response = pc.getResponse();
207
	response.setLocale(locale);
209
        response.setLocale(locale);
208
	
210
209
	// get response character encoding and store it in session attribute
211
        // get response character encoding and store it in session attribute
210
	if (pc.getSession() != null) {
212
        if (pc.getSession() != null) {
211
            try {
213
            try {
212
	        pc.setAttribute(RequestEncodingSupport.REQUEST_CHAR_SET,
214
                pc.setAttribute(RequestEncodingSupport.REQUEST_CHAR_SET,
213
			    response.getCharacterEncoding(),
215
                        response.getCharacterEncoding(),
214
			    PageContext.SESSION_SCOPE);
216
                        PageContext.SESSION_SCOPE);
215
            } catch (IllegalStateException ex) {} // invalidated session ignored
217
            } catch (IllegalStateException ex) {
216
	}
218
            } // invalidated session ignored
219
        }
217
    }
220
    }
218
 
221
219
    /*
222
    /*
220
     * Returns the formatting locale to use with the given formatting action
223
    * Returns the formatting locale to use with the given formatting action
221
     * in the given page.
224
    * in the given page.
222
     *
225
    *
223
     * @param pc The page context containing the formatting action
226
    * @param pc The page context containing the formatting action
224
     * @param fromTag The formatting action
227
    * @param fromTag The formatting action
225
     * @param format <tt>true</tt> if the formatting action is of type
228
    * @param format <tt>true</tt> if the formatting action is of type
226
     * <formatXXX> (as opposed to <parseXXX>), and <tt>false</tt> otherwise
229
    * <formatXXX> (as opposed to <parseXXX>), and <tt>false</tt> otherwise
227
     * (if set to <tt>true</tt>, the formatting locale that is returned by
230
    * (if set to <tt>true</tt>, the formatting locale that is returned by
228
     * this method is used to set the response locale).
231
    * this method is used to set the response locale).
229
     *
232
    *
230
     * @param avail the array of available locales
233
    * @param avail the array of available locales
231
     *
234
    *
232
     * @return the formatting locale to use
235
    * @return the formatting locale to use
233
     */
236
    */
237
234
    static Locale getFormattingLocale(PageContext pc,
238
    static Locale getFormattingLocale(PageContext pc,
235
				      Tag fromTag,
239
                                      Tag fromTag,
236
				      boolean format,
240
                                      boolean format,
237
				      Locale[] avail) {
241
                                      Locale[] avail) {
238
242
239
	LocalizationContext locCtxt = null;
243
        LocalizationContext locCtxt = null;
240
	
241
	// Get formatting locale from enclosing <fmt:bundle>
242
	Tag parent = findAncestorWithClass(fromTag, BundleSupport.class);
243
	if (parent != null) {
244
	    /*
245
	     * use locale from localization context established by parent
246
	     * <fmt:bundle> action, unless that locale is null
247
	     */
248
	    locCtxt = ((BundleSupport) parent).getLocalizationContext();
249
	    if (locCtxt.getLocale() != null) {
250
		if (format) {
251
		    setResponseLocale(pc, locCtxt.getLocale());
252
		}
253
		return locCtxt.getLocale();
254
	    }
255
	}
256
244
257
	// Use locale from default I18N localization context, unless it is null
245
        // Get formatting locale from enclosing <fmt:bundle>
258
	if ((locCtxt = BundleSupport.getLocalizationContext(pc)) != null) {
246
        Tag parent = findAncestorWithClass(fromTag, BundleSupport.class);
259
	    if (locCtxt.getLocale() != null) {
247
        if (parent != null) {
260
		if (format) {
248
            /*
261
		    setResponseLocale(pc, locCtxt.getLocale());
249
            * use locale from localization context established by parent
262
		}
250
            * <fmt:bundle> action, unless that locale is null
263
		return locCtxt.getLocale();
251
            */
264
	    }
252
            locCtxt = ((BundleSupport) parent).getLocalizationContext();
265
	}
253
            if (locCtxt.getLocale() != null) {
254
                if (format) {
255
                    setResponseLocale(pc, locCtxt.getLocale());
256
                }
257
                return locCtxt.getLocale();
258
            }
259
        }
266
260
267
	/*
261
        // Use locale from default I18N localization context, unless it is null
268
	 * Establish formatting locale by comparing the preferred locales
262
        if ((locCtxt = BundleSupport.getLocalizationContext(pc)) != null) {
269
	 * (in order of preference) against the available formatting
263
            if (locCtxt.getLocale() != null) {
270
	 * locales, and determining the best matching locale.
264
                if (format) {
271
	 */
265
                    setResponseLocale(pc, locCtxt.getLocale());
272
	Locale match = null;
266
                }
273
	Locale pref = getLocale(pc, Config.FMT_LOCALE);
267
                return locCtxt.getLocale();
274
	if (pref != null) {
268
            }
275
	    // Preferred locale is application-based
269
        }
276
	    match = findFormattingMatch(pref, avail);
277
	} else {
278
	    // Preferred locales are browser-based 
279
	    match = findFormattingMatch(pc, avail);
280
	}
281
	if (match == null) {
282
	    //Use fallback locale.
283
	    pref = getLocale(pc, Config.FMT_FALLBACK_LOCALE);
284
	    if (pref != null) {
285
		match = findFormattingMatch(pref, avail);
286
	    }
287
	}
288
 	if (format && (match != null)) {
289
	    setResponseLocale(pc, match);
290
	}
291
270
292
	return match;
271
        /*
272
       * Establish formatting locale by comparing the preferred locales
273
       * (in order of preference) against the available formatting
274
       * locales, and determining the best matching locale.
275
       */
276
        Locale match = null;
277
        Locale pref = getLocale(pc, Config.FMT_LOCALE);
278
        if (pref != null) {
279
            // Preferred locale is application-based
280
            match = findFormattingMatch(pref, avail);
281
        } else {
282
            // Preferred locales are browser-based
283
            match = findFormattingMatch(pc, avail);
284
        }
285
        if (match == null) {
286
            //Use fallback locale.
287
            pref = getLocale(pc, Config.FMT_FALLBACK_LOCALE);
288
            if (pref != null) {
289
                match = findFormattingMatch(pref, avail);
290
            }
291
        }
292
        if (format && (match != null)) {
293
            setResponseLocale(pc, match);
294
        }
295
296
        return match;
293
    }
297
    }
294
298
295
    /**
299
    /**
Lines 297-308 Link Here
297
     * by getFormattingLocale(PageContext).
301
     * by getFormattingLocale(PageContext).
298
     */
302
     */
299
    static Locale[] availableFormattingLocales;
303
    static Locale[] availableFormattingLocales;
304
300
    static {
305
    static {
301
        Locale[] dateLocales = DateFormat.getAvailableLocales();
306
        Locale[] dateLocales = DateFormat.getAvailableLocales();
302
        Locale[] numberLocales = NumberFormat.getAvailableLocales();
307
        Locale[] numberLocales = NumberFormat.getAvailableLocales();
303
        Vector vec = new Vector(dateLocales.length);
308
        Vector vec = new Vector(dateLocales.length);
304
        for (int i=0; i<dateLocales.length; i++) {
309
        for (int i = 0; i < dateLocales.length; i++) {
305
            for (int j=0; j<numberLocales.length; j++) {
310
            for (int j = 0; j < numberLocales.length; j++) {
306
                if (dateLocales[i].equals(numberLocales[j])) {
311
                if (dateLocales[i].equals(numberLocales[j])) {
307
                    vec.add(dateLocales[i]);
312
                    vec.add(dateLocales[i]);
308
                    break;
313
                    break;
Lines 310-357 Link Here
310
            }
315
            }
311
        }
316
        }
312
        availableFormattingLocales = new Locale[vec.size()];
317
        availableFormattingLocales = new Locale[vec.size()];
313
        availableFormattingLocales = (Locale[])vec.toArray(availableFormattingLocales);
318
        availableFormattingLocales = (Locale[]) vec.toArray(availableFormattingLocales);
314
        /*
319
        /*
315
        for (int i=0; i<availableFormattingLocales.length; i++) {
320
        for (int i=0; i<availableFormattingLocales.length; i++) {
316
            System.out.println("AvailableLocale[" + i + "] " + availableFormattingLocales[i]);
321
            System.out.println("AvailableLocale[" + i + "] " + availableFormattingLocales[i]);
317
        }
322
        }
318
        */
323
        */
319
    }
324
    }
320
    
325
321
    /*
326
    /*
322
     * Returns the formatting locale to use when <fmt:message> is used
327
    * Returns the formatting locale to use when <fmt:message> is used
323
     * with a locale-less localization context.
328
    * with a locale-less localization context.
324
     *
329
    *
325
     * @param pc The page context containing the formatting action
330
    * @param pc The page context containing the formatting action
326
     * @return the formatting locale to use
331
    * @return the formatting locale to use
327
     */
332
    */
333
328
    static Locale getFormattingLocale(PageContext pc) {
334
    static Locale getFormattingLocale(PageContext pc) {
329
	/*
335
        /*
330
	 * Establish formatting locale by comparing the preferred locales
336
       * Establish formatting locale by comparing the preferred locales
331
	 * (in order of preference) against the available formatting
337
       * (in order of preference) against the available formatting
332
	 * locales, and determining the best matching locale.
338
       * locales, and determining the best matching locale.
333
	 */
339
       */
334
	Locale match = null;
340
        Locale match = null;
335
	Locale pref = getLocale(pc, Config.FMT_LOCALE);
341
        Locale pref = getLocale(pc, Config.FMT_LOCALE);
336
	if (pref != null) {
342
        if (pref != null) {
337
	    // Preferred locale is application-based
343
            // Preferred locale is application-based
338
	    match = findFormattingMatch(pref, availableFormattingLocales);
344
            match = findFormattingMatch(pref, availableFormattingLocales);
339
	} else {
345
        } else {
340
	    // Preferred locales are browser-based 
346
            // Preferred locales are browser-based
341
	    match = findFormattingMatch(pc, availableFormattingLocales);
347
            match = findFormattingMatch(pc, availableFormattingLocales);
342
	}
348
        }
343
	if (match == null) {
349
        if (match == null) {
344
	    //Use fallback locale.
350
            //Use fallback locale.
345
	    pref = getLocale(pc, Config.FMT_FALLBACK_LOCALE);
351
            pref = getLocale(pc, Config.FMT_FALLBACK_LOCALE);
346
	    if (pref != null) {
352
            if (pref != null) {
347
		match = findFormattingMatch(pref, availableFormattingLocales);
353
                match = findFormattingMatch(pref, availableFormattingLocales);
348
	    }
354
            }
349
	}
355
        }
350
 	if (match != null) {
356
        if (match != null) {
351
	    setResponseLocale(pc, match);
357
            setResponseLocale(pc, match);
352
	}
358
        }
353
359
354
	return match;
360
        return match;
355
    }
361
    }
356
362
357
    /*
363
    /*
Lines 372-390 Link Here
372
     * configuration parameter, or <tt>null</tt> if no scoped attribute or
378
     * configuration parameter, or <tt>null</tt> if no scoped attribute or
373
     * configuration parameter with the given name exists
379
     * configuration parameter with the given name exists
374
     */
380
     */
381
375
    static Locale getLocale(PageContext pageContext, String name) {
382
    static Locale getLocale(PageContext pageContext, String name) {
376
	Locale loc = null;
383
        Locale loc = null;
377
384
378
	Object obj = Config.find(pageContext, name);
385
        Object obj = Config.find(pageContext, name);
379
	if (obj != null) {
386
        if (obj != null) {
380
	    if (obj instanceof Locale) {
387
            if (obj instanceof Locale) {
381
		loc = (Locale) obj;
388
                loc = (Locale) obj;
382
	    } else {
389
            } else {
383
		loc = parseLocale((String) obj);
390
                loc = parseLocale((String) obj);
384
	    }
391
            }
385
	}
392
        }
386
393
387
	return loc;
394
        return loc;
388
    }
395
    }
389
396
390
397
Lines 401-419 Link Here
401
     *
408
     *
402
     * @return Best matching locale, or <tt>null</tt> if no match was found
409
     * @return Best matching locale, or <tt>null</tt> if no match was found
403
     */
410
     */
411
404
    private static Locale findFormattingMatch(PageContext pageContext,
412
    private static Locale findFormattingMatch(PageContext pageContext,
405
					      Locale[] avail) {
413
                                              Locale[] avail) {
406
	Locale match = null;
414
        Locale match = null;
407
	for (Enumeration enum_ = Util.getRequestLocales((HttpServletRequest)pageContext.getRequest());
415
        for (Enumeration enum_ = Util.getRequestLocales((HttpServletRequest) pageContext.getRequest());
408
	     enum_.hasMoreElements(); ) {
416
             enum_.hasMoreElements();) {
409
            Locale locale = (Locale)enum_.nextElement();
417
            Locale locale = (Locale) enum_.nextElement();
410
	    match = findFormattingMatch(locale, avail);
418
            match = findFormattingMatch(locale, avail);
411
	    if (match != null) {
419
            if (match != null) {
412
		break;
420
                break;
413
	    }
421
            }
414
	}
422
        }
415
	
423
416
	return match;
424
        return match;
417
    }
425
    }
418
426
419
    /*
427
    /*
Lines 435-466 Link Here
435
     * @return Available locale that best matches the given preferred locale,
443
     * @return Available locale that best matches the given preferred locale,
436
     * or <tt>null</tt> if no match exists
444
     * or <tt>null</tt> if no match exists
437
     */
445
     */
446
438
    private static Locale findFormattingMatch(Locale pref, Locale[] avail) {
447
    private static Locale findFormattingMatch(Locale pref, Locale[] avail) {
439
	Locale match = null;
448
        Locale match = null;
440
        boolean langAndCountryMatch = false;
449
        boolean langAndCountryMatch = false;
441
        for (int i=0; i<avail.length; i++) {
450
        for (int i = 0; i < avail.length; i++) {
442
            if (pref.equals(avail[i])) {
451
            if (pref.equals(avail[i])) {
443
                // Exact match
452
                // Exact match
444
                match = avail[i];
453
                match = avail[i];
445
                break;
454
                break;
446
            } else if (
455
            } else if (
447
                    !"".equals(pref.getVariant()) &&
456
                    !"".equals(pref.getVariant()) &&
448
                    "".equals(avail[i].getVariant()) &&
457
                            "".equals(avail[i].getVariant()) &&
449
                    pref.getLanguage().equals(avail[i].getLanguage()) &&
458
                            pref.getLanguage().equals(avail[i].getLanguage()) &&
450
                    pref.getCountry().equals(avail[i].getCountry())) {
459
                            pref.getCountry().equals(avail[i].getCountry())) {
451
                // Language and country match; different variant
460
                // Language and country match; different variant
452
                match = avail[i];
461
                match = avail[i];
453
                langAndCountryMatch = true;
462
                langAndCountryMatch = true;
454
            } else if (
463
            } else if (
455
                    !langAndCountryMatch &&
464
                    !langAndCountryMatch &&
456
                    pref.getLanguage().equals(avail[i].getLanguage()) &&
465
                            pref.getLanguage().equals(avail[i].getLanguage()) &&
457
                    ("".equals(avail[i].getCountry()))) {
466
                            ("".equals(avail[i].getCountry()))) {
458
                // Language match
467
                // Language match
459
                if (match == null) {
468
                if (match == null) {
460
                    match = avail[i];
469
                    match = avail[i];
461
                }
470
                }
462
            }
471
            }
463
        }
472
        }
464
	return match;
473
        return match;
465
    }
474
    }
466
}
475
}
(-)src/main/java/org/apache/taglibs/standard/tag/common/fmt/RequestEncodingSupport.java (-31 / +32 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tag.common.fmt;
18
package org.apache.taglibs.standard.tag.common.fmt;
19
19
Lines 38-44 Link Here
38
    // Package-scoped constants
38
    // Package-scoped constants
39
39
40
    static final String REQUEST_CHAR_SET =
40
    static final String REQUEST_CHAR_SET =
41
	"javax.servlet.jsp.jstl.fmt.request.charset";
41
            "javax.servlet.jsp.jstl.fmt.request.charset";
42
42
43
43
44
    //*********************************************************************
44
    //*********************************************************************
Lines 51-74 Link Here
51
    // Tag attributes
51
    // Tag attributes
52
52
53
    protected String value;             // 'value' attribute
53
    protected String value;             // 'value' attribute
54
    
55
54
55
56
    //*********************************************************************
56
    //*********************************************************************
57
    // Derived information
57
    // Derived information
58
    
58
59
    protected String charEncoding;   // derived from 'value' attribute  
59
    protected String charEncoding;   // derived from 'value' attribute  
60
    
61
60
61
62
    //*********************************************************************
62
    //*********************************************************************
63
    // Constructor and initialization
63
    // Constructor and initialization
64
64
65
    public RequestEncodingSupport() {
65
    public RequestEncodingSupport() {
66
	super();
66
        super();
67
	init();
67
        init();
68
    }
68
    }
69
69
70
    private void init() {
70
    private void init() {
71
	value = null;
71
        value = null;
72
    }
72
    }
73
73
74
74
Lines 78-113 Link Here
78
    @Override
78
    @Override
79
    public int doEndTag() throws JspException {
79
    public int doEndTag() throws JspException {
80
        charEncoding = value;
80
        charEncoding = value;
81
	if ((charEncoding == null)
81
        if ((charEncoding == null)
82
	        && (pageContext.getRequest().getCharacterEncoding() == null)) { 
82
                && (pageContext.getRequest().getCharacterEncoding() == null)) {
83
            // Use charset from session-scoped attribute
83
            // Use charset from session-scoped attribute
84
	    charEncoding = (String)
84
            charEncoding = (String)
85
		pageContext.getAttribute(REQUEST_CHAR_SET,
85
                    pageContext.getAttribute(REQUEST_CHAR_SET,
86
					 PageContext.SESSION_SCOPE);
86
                            PageContext.SESSION_SCOPE);
87
	    if (charEncoding == null) {
87
            if (charEncoding == null) {
88
		// Use default encoding
88
                // Use default encoding
89
		charEncoding = DEFAULT_ENCODING;
89
                charEncoding = DEFAULT_ENCODING;
90
	    }
90
            }
91
	}
91
        }
92
92
93
	/*
93
        /*
94
	 * If char encoding was already set in the request, we don't need to 
94
       * If char encoding was already set in the request, we don't need to
95
	 * set it again.
95
       * set it again.
96
	 */
96
       */
97
	if (charEncoding != null) {
97
        if (charEncoding != null) {
98
	    try {
98
            try {
99
		pageContext.getRequest().setCharacterEncoding(charEncoding);
99
                pageContext.getRequest().setCharacterEncoding(charEncoding);
100
	    } catch (UnsupportedEncodingException uee) {
100
            } catch (UnsupportedEncodingException uee) {
101
		throw new JspTagException(uee.toString(), uee);
101
                throw new JspTagException(uee.toString(), uee);
102
	    }
102
            }
103
	}
103
        }
104
104
105
	return EVAL_PAGE;
105
        return EVAL_PAGE;
106
    }
106
    }
107
107
108
    // Releases any resources we may have (or inherit)
108
    // Releases any resources we may have (or inherit)
109
109
    @Override
110
    @Override
110
    public void release() {
111
    public void release() {
111
	init();
112
        init();
112
    }
113
    }
113
}
114
}
(-)src/main/java/org/apache/taglibs/standard/tag/common/fmt/ParamSupport.java (-30 / +32 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tag.common.fmt;
18
package org.apache.taglibs.standard.tag.common.fmt;
19
19
Lines 29-36 Link Here
29
 * subtag in JSTL 1.0 which supplies an argument for parametric replacement
29
 * subtag in JSTL 1.0 which supplies an argument for parametric replacement
30
 * to its parent &lt;message&gt; tag.
30
 * to its parent &lt;message&gt; tag.
31
 *
31
 *
32
 * @author Jan Luehe
32
 * @see MessageSupport
33
 * @see MessageSupport
33
 * @author Jan Luehe
34
 */
34
 */
35
35
36
public abstract class ParamSupport extends BodyTagSupport {
36
public abstract class ParamSupport extends BodyTagSupport {
Lines 39-58 Link Here
39
    // Protected state
39
    // Protected state
40
40
41
    protected Object value;                          // 'value' attribute
41
    protected Object value;                          // 'value' attribute
42
    protected boolean valueSpecified;	             // status
42
    protected boolean valueSpecified;                 // status
43
43
44
44
45
    //*********************************************************************
45
    //*********************************************************************
46
    // Constructor and initialization
46
    // Constructor and initialization
47
47
48
    public ParamSupport() {
48
    public ParamSupport() {
49
	super();
49
        super();
50
	init();
50
        init();
51
    }
51
    }
52
52
53
    private void init() {
53
    private void init() {
54
	value = null;
54
        value = null;
55
	valueSpecified = false;
55
        valueSpecified = false;
56
    }
56
    }
57
57
58
58
Lines 60-97 Link Here
60
    // Tag logic
60
    // Tag logic
61
61
62
    // Supply our value to our parent <fmt:message> tag
62
    // Supply our value to our parent <fmt:message> tag
63
63
    @Override
64
    @Override
64
    public int doEndTag() throws JspException {
65
    public int doEndTag() throws JspException {
65
	Tag t = findAncestorWithClass(this, MessageSupport.class);
66
        Tag t = findAncestorWithClass(this, MessageSupport.class);
66
	if (t == null) {
67
        if (t == null) {
67
	    throw new JspTagException(Resources.getMessage(
68
            throw new JspTagException(Resources.getMessage(
68
                            "PARAM_OUTSIDE_MESSAGE"));
69
                    "PARAM_OUTSIDE_MESSAGE"));
69
	}
70
        }
70
	MessageSupport parent = (MessageSupport) t;
71
        MessageSupport parent = (MessageSupport) t;
71
72
72
	/*
73
        /*
73
	 * Get argument from 'value' attribute or body, as appropriate, and
74
       * Get argument from 'value' attribute or body, as appropriate, and
74
	 * add it to enclosing <fmt:message> tag, even if it is null or equal
75
       * add it to enclosing <fmt:message> tag, even if it is null or equal
75
	 * to "".
76
       * to "".
76
	 */
77
       */
77
	Object input = null;
78
        Object input = null;
78
        // determine the input by...
79
        // determine the input by...
79
	if (valueSpecified) {
80
        if (valueSpecified) {
80
	    // ... reading 'value' attribute
81
            // ... reading 'value' attribute
81
	    input = value;
82
            input = value;
82
	} else {
83
        } else {
83
	    // ... retrieving and trimming our body (TLV has ensured that it's
84
            // ... retrieving and trimming our body (TLV has ensured that it's
84
	    // non-empty)
85
            // non-empty)
85
	    input = bodyContent.getString().trim();
86
            input = bodyContent.getString().trim();
86
	}
87
        }
87
	parent.addParam(input);
88
        parent.addParam(input);
88
89
89
	return EVAL_PAGE;
90
        return EVAL_PAGE;
90
    }
91
    }
91
92
92
    // Releases any resources we may have (or inherit)
93
    // Releases any resources we may have (or inherit)
94
93
    @Override
95
    @Override
94
    public void release() {
96
    public void release() {
95
	init();
97
        init();
96
    }
98
    }
97
}
99
}
(-)src/main/java/org/apache/taglibs/standard/tag/common/fmt/FormatNumberSupport.java (-164 / +175 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tag.common.fmt;
18
package org.apache.taglibs.standard.tag.common.fmt;
19
19
Lines 45-52 Link Here
45
    // Private constants
45
    // Private constants
46
46
47
    private static final Class[] GET_INSTANCE_PARAM_TYPES =
47
    private static final Class[] GET_INSTANCE_PARAM_TYPES =
48
	new Class[] { String.class };
48
            new Class[]{String.class};
49
    private static final String NUMBER = "number";    
49
    private static final String NUMBER = "number";
50
    private static final String CURRENCY = "currency";
50
    private static final String CURRENCY = "currency";
51
    private static final String PERCENT = "percent";
51
    private static final String PERCENT = "percent";
52
52
Lines 55-61 Link Here
55
    // Protected state
55
    // Protected state
56
56
57
    protected Object value;                    // 'value' attribute
57
    protected Object value;                    // 'value' attribute
58
    protected boolean valueSpecified;	       // status
58
    protected boolean valueSpecified;           // status
59
    protected String type;                     // 'type' attribute
59
    protected String type;                     // 'type' attribute
60
    protected String pattern;                  // 'pattern' attribute
60
    protected String pattern;                  // 'pattern' attribute
61
    protected String currencyCode;             // 'currencyCode' attribute
61
    protected String currencyCode;             // 'currencyCode' attribute
Lines 84-113 Link Here
84
    // Constructor and initialization
84
    // Constructor and initialization
85
85
86
    static {
86
    static {
87
	try {
87
        try {
88
	    currencyClass = Class.forName("java.util.Currency");
88
            currencyClass = Class.forName("java.util.Currency");
89
	    // container's runtime is J2SE 1.4 or greater
89
            // container's runtime is J2SE 1.4 or greater
90
	} catch (Exception cnfe) {
90
        } catch (Exception cnfe) {
91
	}
91
        }
92
    }
92
    }
93
93
94
    public FormatNumberSupport() {
94
    public FormatNumberSupport() {
95
	super();
95
        super();
96
	init();
96
        init();
97
    }
97
    }
98
98
99
    private void init() {
99
    private void init() {
100
	value = type = null;
100
        value = type = null;
101
	valueSpecified = false;
101
        valueSpecified = false;
102
	pattern = var = currencyCode = currencySymbol = null;
102
        pattern = var = currencyCode = currencySymbol = null;
103
	groupingUsedSpecified = false;
103
        groupingUsedSpecified = false;
104
	maxIntegerDigitsSpecified = minIntegerDigitsSpecified = false;
104
        maxIntegerDigitsSpecified = minIntegerDigitsSpecified = false;
105
	maxFractionDigitsSpecified = minFractionDigitsSpecified = false;
105
        maxFractionDigitsSpecified = minFractionDigitsSpecified = false;
106
	scope = PageContext.PAGE_SCOPE;
106
        scope = PageContext.PAGE_SCOPE;
107
    }
107
    }
108
108
109
109
110
   //*********************************************************************
110
    //*********************************************************************
111
    // Tag attributes known at translation time
111
    // Tag attributes known at translation time
112
112
113
    public void setVar(String var) {
113
    public void setVar(String var) {
Lines 115-121 Link Here
115
    }
115
    }
116
116
117
    public void setScope(String scope) {
117
    public void setScope(String scope) {
118
	this.scope = Util.getScope(scope);
118
        this.scope = Util.getScope(scope);
119
    }
119
    }
120
120
121
121
Lines 124-221 Link Here
124
124
125
    @Override
125
    @Override
126
    public int doEndTag() throws JspException {
126
    public int doEndTag() throws JspException {
127
	String formatted = null;
127
        String formatted = null;
128
        Object input = null;
128
        Object input = null;
129
129
130
        // determine the input by...
130
        // determine the input by...
131
        if (valueSpecified) {
131
        if (valueSpecified) {
132
	    // ... reading 'value' attribute
132
            // ... reading 'value' attribute
133
	    input = value;
133
            input = value;
134
	} else {
134
        } else {
135
	    // ... retrieving and trimming our body
135
            // ... retrieving and trimming our body
136
	    if (bodyContent != null && bodyContent.getString() != null)
136
            if (bodyContent != null && bodyContent.getString() != null) {
137
	        input = bodyContent.getString().trim();
137
                input = bodyContent.getString().trim();
138
	}
138
            }
139
        }
139
140
140
	if ((input == null) || input.equals("")) {
141
        if ((input == null) || input.equals("")) {
141
	    // Spec says:
142
            // Spec says:
142
            // If value is null or empty, remove the scoped variable 
143
            // If value is null or empty, remove the scoped variable 
143
            // if it is specified (see attributes var and scope).
144
            // if it is specified (see attributes var and scope).
144
	    if (var != null) {
145
            if (var != null) {
145
	        pageContext.removeAttribute(var, scope);
146
                pageContext.removeAttribute(var, scope);
146
            }
147
            }
147
	    return EVAL_PAGE;
148
            return EVAL_PAGE;
148
	}
149
        }
149
150
150
	/*
151
        /*
151
	 * If 'value' is a String, it is first parsed into an instance of
152
       * If 'value' is a String, it is first parsed into an instance of
152
	 * java.lang.Number
153
       * java.lang.Number
153
	 */
154
       */
154
	if (input instanceof String) {
155
        if (input instanceof String) {
155
	    try {
156
            try {
156
		if (((String) input).indexOf('.') != -1) {
157
                if (((String) input).indexOf('.') != -1) {
157
		    input = Double.valueOf((String) input);
158
                    input = Double.valueOf((String) input);
158
		} else {
159
                } else {
159
		    input = Long.valueOf((String) input);
160
                    input = Long.valueOf((String) input);
160
		}
161
                }
161
	    } catch (NumberFormatException nfe) {
162
            } catch (NumberFormatException nfe) {
162
		throw new JspException(
163
                throw new JspException(
163
                    Resources.getMessage("FORMAT_NUMBER_PARSE_ERROR", input),
164
                        Resources.getMessage("FORMAT_NUMBER_PARSE_ERROR", input),
164
		    nfe);
165
                        nfe);
165
	    }
166
            }
166
	}
167
        }
167
168
168
	// Determine formatting locale
169
        // Determine formatting locale
169
	Locale loc = SetLocaleSupport.getFormattingLocale(
170
        Locale loc = SetLocaleSupport.getFormattingLocale(
170
            pageContext,
171
                pageContext,
171
	    this,
172
                this,
172
	    true,
173
                true,
173
	    NumberFormat.getAvailableLocales());
174
                NumberFormat.getAvailableLocales());
174
175
175
	if (loc != null) {
176
        if (loc != null) {
176
	    // Create formatter 
177
            // Create formatter
177
	    NumberFormat formatter = null;
178
            NumberFormat formatter = null;
178
	    if ((pattern != null) && !pattern.equals("")) {
179
            if ((pattern != null) && !pattern.equals("")) {
179
		// if 'pattern' is specified, 'type' is ignored
180
                // if 'pattern' is specified, 'type' is ignored
180
		DecimalFormatSymbols symbols = new DecimalFormatSymbols(loc);
181
                DecimalFormatSymbols symbols = new DecimalFormatSymbols(loc);
181
		formatter = new DecimalFormat(pattern, symbols);
182
                formatter = new DecimalFormat(pattern, symbols);
182
	    } else {
183
            } else {
183
		formatter = createFormatter(loc);
184
                formatter = createFormatter(loc);
184
	    }
185
            }
185
	    if (((pattern != null) && !pattern.equals(""))
186
            if (((pattern != null) && !pattern.equals(""))
186
		    || CURRENCY.equalsIgnoreCase(type)) {
187
                    || CURRENCY.equalsIgnoreCase(type)) {
187
		try {
188
                try {
188
		    setCurrency(formatter);
189
                    setCurrency(formatter);
189
		} catch (Exception e) {
190
                } catch (Exception e) {
190
		    throw new JspException(
191
                    throw new JspException(
191
                        Resources.getMessage("FORMAT_NUMBER_CURRENCY_ERROR"),
192
                            Resources.getMessage("FORMAT_NUMBER_CURRENCY_ERROR"),
192
			e);
193
                            e);
193
		}
194
                }
194
	    }
195
            }
195
	    configureFormatter(formatter);
196
            configureFormatter(formatter);
196
	    formatted = formatter.format(input);
197
            formatted = formatter.format(input);
197
	} else {
198
        } else {
198
	    // no formatting locale available, use toString()
199
            // no formatting locale available, use toString()
199
	    formatted = input.toString();
200
            formatted = input.toString();
200
	}
201
        }
201
202
202
	if (var != null) {
203
        if (var != null) {
203
	    pageContext.setAttribute(var, formatted, scope);	
204
            pageContext.setAttribute(var, formatted, scope);
204
	} else {
205
        } else {
205
	    try {
206
            try {
206
		pageContext.getOut().print(formatted);
207
                pageContext.getOut().print(formatted);
207
	    } catch (IOException ioe) {
208
            } catch (IOException ioe) {
208
		throw new JspTagException(ioe.toString(), ioe);
209
                throw new JspTagException(ioe.toString(), ioe);
209
	    }
210
            }
210
	}
211
        }
211
212
212
	return EVAL_PAGE;
213
        return EVAL_PAGE;
213
    }
214
    }
214
215
215
    // Releases any resources we may have (or inherit)
216
    // Releases any resources we may have (or inherit)
217
216
    @Override
218
    @Override
217
    public void release() {
219
    public void release() {
218
	init();
220
        init();
219
    }
221
    }
220
222
221
223
Lines 223-242 Link Here
223
    // Private utility methods
225
    // Private utility methods
224
226
225
    private NumberFormat createFormatter(Locale loc) throws JspException {
227
    private NumberFormat createFormatter(Locale loc) throws JspException {
226
	NumberFormat formatter = null;
228
        NumberFormat formatter = null;
227
	
229
228
	if ((type == null) || NUMBER.equalsIgnoreCase(type)) {
230
        if ((type == null) || NUMBER.equalsIgnoreCase(type)) {
229
	    formatter = NumberFormat.getNumberInstance(loc);
231
            formatter = NumberFormat.getNumberInstance(loc);
230
	} else if (CURRENCY.equalsIgnoreCase(type)) {
232
        } else if (CURRENCY.equalsIgnoreCase(type)) {
231
	    formatter = NumberFormat.getCurrencyInstance(loc);
233
            formatter = NumberFormat.getCurrencyInstance(loc);
232
	} else if (PERCENT.equalsIgnoreCase(type)) {
234
        } else if (PERCENT.equalsIgnoreCase(type)) {
233
	    formatter = NumberFormat.getPercentInstance(loc);
235
            formatter = NumberFormat.getPercentInstance(loc);
234
	} else {
236
        } else {
235
	    throw new JspException(
237
            throw new JspException(
236
	        Resources.getMessage("FORMAT_NUMBER_INVALID_TYPE", type));
238
                    Resources.getMessage("FORMAT_NUMBER_INVALID_TYPE", type));
237
	}
239
        }
238
	
240
239
	return formatter;
241
        return formatter;
240
    }
242
    }
241
243
242
    /*
244
    /*
Lines 244-260 Link Here
244
     * 'maxFractionDigits', and 'minFractionDigits' attributes to the given
246
     * 'maxFractionDigits', and 'minFractionDigits' attributes to the given
245
     * formatter.
247
     * formatter.
246
     */
248
     */
249
247
    private void configureFormatter(NumberFormat formatter) {
250
    private void configureFormatter(NumberFormat formatter) {
248
	if (groupingUsedSpecified)
251
        if (groupingUsedSpecified) {
249
	    formatter.setGroupingUsed(isGroupingUsed);
252
            formatter.setGroupingUsed(isGroupingUsed);
250
	if (maxIntegerDigitsSpecified)
253
        }
251
	    formatter.setMaximumIntegerDigits(maxIntegerDigits);
254
        if (maxIntegerDigitsSpecified) {
252
	if (minIntegerDigitsSpecified)
255
            formatter.setMaximumIntegerDigits(maxIntegerDigits);
253
	    formatter.setMinimumIntegerDigits(minIntegerDigits);
256
        }
254
	if (maxFractionDigitsSpecified)
257
        if (minIntegerDigitsSpecified) {
255
	    formatter.setMaximumFractionDigits(maxFractionDigits);
258
            formatter.setMinimumIntegerDigits(minIntegerDigits);
256
	if (minFractionDigitsSpecified)
259
        }
257
	    formatter.setMinimumFractionDigits(minFractionDigits);
260
        if (maxFractionDigitsSpecified) {
261
            formatter.setMaximumFractionDigits(maxFractionDigits);
262
        }
263
        if (minFractionDigitsSpecified) {
264
            formatter.setMinimumFractionDigits(minFractionDigits);
265
        }
258
    }
266
    }
259
267
260
    /*
268
    /*
Lines 285-341 Link Here
285
     * <1.4        EUR           \u20AC       \u20AC
293
     * <1.4        EUR           \u20AC       \u20AC
286
     * >=1.4       EUR           \u20AC       Locale's currency symbol for Euro
294
     * >=1.4       EUR           \u20AC       Locale's currency symbol for Euro
287
     */
295
     */
296
288
    private void setCurrency(NumberFormat formatter) throws Exception {
297
    private void setCurrency(NumberFormat formatter) throws Exception {
289
	String code = null;
298
        String code = null;
290
	String symbol = null;
299
        String symbol = null;
291
300
292
	if ((currencyCode == null) && (currencySymbol == null)) {
301
        if ((currencyCode == null) && (currencySymbol == null)) {
293
	    return;
302
            return;
294
	}
303
        }
295
304
296
	if ((currencyCode != null) && (currencySymbol != null)) {
305
        if ((currencyCode != null) && (currencySymbol != null)) {
297
	    if (currencyClass != null)
306
            if (currencyClass != null) {
298
		code = currencyCode;
307
                code = currencyCode;
299
	    else
308
            } else {
300
		symbol = currencySymbol;
309
                symbol = currencySymbol;
301
	} else if (currencyCode == null) {
310
            }
302
	    symbol = currencySymbol;
311
        } else if (currencyCode == null) {
303
	} else {
312
            symbol = currencySymbol;
304
	    if (currencyClass != null)
313
        } else {
305
		code = currencyCode;
314
            if (currencyClass != null) {
306
	    else
315
                code = currencyCode;
307
		symbol = currencyCode;
316
            } else {
308
	}
317
                symbol = currencyCode;
318
            }
319
        }
309
320
310
	if (code != null) {
321
        if (code != null) {
311
	    Object[] methodArgs = new Object[1];
322
            Object[] methodArgs = new Object[1];
312
323
313
	    /*
324
            /*
314
	     * java.util.Currency.getInstance()
325
            * java.util.Currency.getInstance()
315
	     */
326
            */
316
	    Method m = currencyClass.getMethod("getInstance",
327
            Method m = currencyClass.getMethod("getInstance",
317
					       GET_INSTANCE_PARAM_TYPES);
328
                    GET_INSTANCE_PARAM_TYPES);
318
	    methodArgs[0] = code;
329
            methodArgs[0] = code;
319
	    Object currency = m.invoke(null, methodArgs);
330
            Object currency = m.invoke(null, methodArgs);
320
331
321
	    /*
332
            /*
322
	     * java.text.NumberFormat.setCurrency()
333
            * java.text.NumberFormat.setCurrency()
323
	     */
334
            */
324
	    Class[] paramTypes = new Class[1];
335
            Class[] paramTypes = new Class[1];
325
	    paramTypes[0] = currencyClass;
336
            paramTypes[0] = currencyClass;
326
	    Class numberFormatClass = Class.forName("java.text.NumberFormat");
337
            Class numberFormatClass = Class.forName("java.text.NumberFormat");
327
	    m = numberFormatClass.getMethod("setCurrency", paramTypes);
338
            m = numberFormatClass.getMethod("setCurrency", paramTypes);
328
	    methodArgs[0] = currency;
339
            methodArgs[0] = currency;
329
	    m.invoke(formatter, methodArgs);
340
            m.invoke(formatter, methodArgs);
330
	} else {
341
        } else {
331
	    /*
342
            /*
332
	     * Let potential ClassCastException propagate up (will almost
343
            * Let potential ClassCastException propagate up (will almost
333
	     * never happen)
344
            * never happen)
334
	     */
345
            */
335
	    DecimalFormat df = (DecimalFormat) formatter;
346
            DecimalFormat df = (DecimalFormat) formatter;
336
	    DecimalFormatSymbols dfs = df.getDecimalFormatSymbols();
347
            DecimalFormatSymbols dfs = df.getDecimalFormatSymbols();
337
	    dfs.setCurrencySymbol(symbol);
348
            dfs.setCurrencySymbol(symbol);
338
	    df.setDecimalFormatSymbols(dfs);
349
            df.setDecimalFormatSymbols(dfs);
339
	}
350
        }
340
    }
351
    }
341
}
352
}
(-)src/main/java/org/apache/taglibs/standard/tag/common/core/UrlSupport.java (-51 / +57 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tag.common.core;
18
package org.apache.taglibs.standard.tag.common.core;
19
19
Lines 34-71 Link Here
34
 */
34
 */
35
35
36
public abstract class UrlSupport extends BodyTagSupport
36
public abstract class UrlSupport extends BodyTagSupport
37
    implements ParamParent {
37
        implements ParamParent {
38
38
39
    //*********************************************************************
39
    //*********************************************************************
40
    // Protected state
40
    // Protected state
41
41
42
    protected String value;                      // 'value' attribute
42
    protected String value;                      // 'value' attribute
43
    protected String context;			 // 'context' attribute
43
    protected String context;             // 'context' attribute
44
44
45
    //*********************************************************************
45
    //*********************************************************************
46
    // Private state
46
    // Private state
47
47
48
    private String var;                          // 'var' attribute
48
    private String var;                          // 'var' attribute
49
    private int scope;				 // processed 'scope' attr
49
    private int scope;                 // processed 'scope' attr
50
    private ParamSupport.ParamManager params;	 // added parameters
50
    private ParamSupport.ParamManager params;     // added parameters
51
51
52
    //*********************************************************************
52
    //*********************************************************************
53
    // Constructor and initialization
53
    // Constructor and initialization
54
54
55
    public UrlSupport() {
55
    public UrlSupport() {
56
	super();
56
        super();
57
	init();
57
        init();
58
    }
58
    }
59
59
60
    private void init() {
60
    private void init() {
61
	value = var = null;
61
        value = var = null;
62
	params = null;
62
        params = null;
63
	context = null;
63
        context = null;
64
	scope = PageContext.PAGE_SCOPE;
64
        scope = PageContext.PAGE_SCOPE;
65
    }
65
    }
66
66
67
67
68
   //*********************************************************************
68
    //*********************************************************************
69
    // Tag attributes known at translation time
69
    // Tag attributes known at translation time
70
70
71
    public void setVar(String var) {
71
    public void setVar(String var) {
Lines 73-79 Link Here
73
    }
73
    }
74
74
75
    public void setScope(String scope) {
75
    public void setScope(String scope) {
76
	this.scope = Util.getScope(scope);
76
        this.scope = Util.getScope(scope);
77
    }
77
    }
78
78
79
79
Lines 81-88 Link Here
81
    // Collaboration with subtags
81
    // Collaboration with subtags
82
82
83
    // inherit Javadoc
83
    // inherit Javadoc
84
84
    public void addParameter(String name, String value) {
85
    public void addParameter(String name, String value) {
85
	params.addParameter(name, value);
86
        params.addParameter(name, value);
86
    }
87
    }
87
88
88
89
Lines 90-136 Link Here
90
    // Tag logic
91
    // Tag logic
91
92
92
    // resets any parameters that might be sent
93
    // resets any parameters that might be sent
94
93
    @Override
95
    @Override
94
    public int doStartTag() throws JspException {
96
    public int doStartTag() throws JspException {
95
	params = new ParamSupport.ParamManager();
97
        params = new ParamSupport.ParamManager();
96
	return EVAL_BODY_BUFFERED;
98
        return EVAL_BODY_BUFFERED;
97
    }
99
    }
98
100
99
101
100
    // gets the right value, encodes it, and prints or stores it
102
    // gets the right value, encodes it, and prints or stores it
103
101
    @Override
104
    @Override
102
    public int doEndTag() throws JspException {
105
    public int doEndTag() throws JspException {
103
	String result;				// the eventual result
106
        String result;                // the eventual result
104
107
105
	// add (already encoded) parameters
108
        // add (already encoded) parameters
106
	String baseUrl = resolveUrl(value, context, pageContext);
109
        String baseUrl = resolveUrl(value, context, pageContext);
107
	result = params.aggregateParams(baseUrl);
110
        result = params.aggregateParams(baseUrl);
108
111
109
	// if the URL is relative, rewrite it
112
        // if the URL is relative, rewrite it
110
	if (!ImportSupport.isAbsoluteUrl(result)) {
113
        if (!ImportSupport.isAbsoluteUrl(result)) {
111
	    HttpServletResponse response =
114
            HttpServletResponse response =
112
                ((HttpServletResponse) pageContext.getResponse());
115
                    ((HttpServletResponse) pageContext.getResponse());
113
            result = response.encodeURL(result);
116
            result = response.encodeURL(result);
114
	}
117
        }
115
118
116
	// store or print the output
119
        // store or print the output
117
	if (var != null)
120
        if (var != null) {
118
	    pageContext.setAttribute(var, result, scope);
121
            pageContext.setAttribute(var, result, scope);
119
	else {
122
        } else {
120
	    try {
123
            try {
121
	        pageContext.getOut().print(result);
124
                pageContext.getOut().print(result);
122
	    } catch (java.io.IOException ex) {
125
            } catch (java.io.IOException ex) {
123
		throw new JspTagException(ex.toString(), ex);
126
                throw new JspTagException(ex.toString(), ex);
124
	    }
127
            }
125
	}
128
        }
126
129
127
	return EVAL_PAGE;
130
        return EVAL_PAGE;
128
    }
131
    }
129
132
130
    // Releases any resources we may have (or inherit)
133
    // Releases any resources we may have (or inherit)
134
131
    @Override
135
    @Override
132
    public void release() {
136
    public void release() {
133
	init();
137
        init();
134
    }
138
    }
135
139
136
    //*********************************************************************
140
    //*********************************************************************
Lines 138-160 Link Here
138
142
139
    public static String resolveUrl(
143
    public static String resolveUrl(
140
            String url, String context, PageContext pageContext)
144
            String url, String context, PageContext pageContext)
141
	    throws JspException {
145
            throws JspException {
142
	// don't touch absolute URLs
146
        // don't touch absolute URLs
143
	if (ImportSupport.isAbsoluteUrl(url))
147
        if (ImportSupport.isAbsoluteUrl(url)) {
144
	    return url;
148
            return url;
149
        }
145
150
146
	// normalize relative URLs against a context root
151
        // normalize relative URLs against a context root
147
	HttpServletRequest request =
152
        HttpServletRequest request =
148
	    (HttpServletRequest) pageContext.getRequest();
153
                (HttpServletRequest) pageContext.getRequest();
149
	if (context == null) {
154
        if (context == null) {
150
	    if (url.startsWith("/"))
155
            if (url.startsWith("/")) {
151
		return (request.getContextPath() + url);
156
                return (request.getContextPath() + url);
152
	    else
157
            } else {
153
		return url;
158
                return url;
154
	} else {
159
            }
160
        } else {
155
            if (!context.startsWith("/") || !url.startsWith("/")) {
161
            if (!context.startsWith("/") || !url.startsWith("/")) {
156
                throw new JspTagException(
162
                throw new JspTagException(
157
                    Resources.getMessage("IMPORT_BAD_RELATIVE"));
163
                        Resources.getMessage("IMPORT_BAD_RELATIVE"));
158
            }
164
            }
159
            if (context.endsWith("/") && url.startsWith("/")) {
165
            if (context.endsWith("/") && url.startsWith("/")) {
160
                // Don't produce string starting with '//', many
166
                // Don't produce string starting with '//', many
(-)src/main/java/org/apache/taglibs/standard/tag/common/core/OutSupport.java (-4 / +5 lines)
Lines 13-30 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tag.common.core;
18
package org.apache.taglibs.standard.tag.common.core;
19
19
20
import org.apache.taglibs.standard.util.EscapeXML;
21
22
import java.io.IOException;
20
import java.io.IOException;
23
21
24
import javax.servlet.jsp.JspException;
22
import javax.servlet.jsp.JspException;
25
import javax.servlet.jsp.JspTagException;
23
import javax.servlet.jsp.JspTagException;
26
import javax.servlet.jsp.tagext.BodyTagSupport;
24
import javax.servlet.jsp.tagext.BodyTagSupport;
27
25
26
import org.apache.taglibs.standard.util.EscapeXML;
27
28
/**
28
/**
29
 * <p>Support for handlers of the &lt;out&gt; tag, which simply evalutes and
29
 * <p>Support for handlers of the &lt;out&gt; tag, which simply evalutes and
30
 * prints the result of the expression it's passed.  If the result is
30
 * prints the result of the expression it's passed.  If the result is
Lines 59-64 Link Here
59
    }
59
    }
60
60
61
    // Releases any resources we may have (or inherit)
61
    // Releases any resources we may have (or inherit)
62
62
    @Override
63
    @Override
63
    public void release() {
64
    public void release() {
64
        output = null;
65
        output = null;
Lines 82-88 Link Here
82
83
83
        // output default if supplied
84
        // output default if supplied
84
        output = evalDefault();
85
        output = evalDefault();
85
        if (output != null ) {
86
        if (output != null) {
86
            return SKIP_BODY;
87
            return SKIP_BODY;
87
        }
88
        }
88
89
(-)src/main/java/org/apache/taglibs/standard/tag/common/core/ForEachSupport.java (-56 / +96 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tag.common.core;
18
package org.apache.taglibs.standard.tag.common.core;
19
19
Lines 40-54 Link Here
40
 * ForEach-specific functionality.  The rtexprvalue library and the
40
 * ForEach-specific functionality.  The rtexprvalue library and the
41
 * expression-evaluating library each have handlers that extend this
41
 * expression-evaluating library each have handlers that extend this
42
 * class.</p>
42
 * class.</p>
43
 *
43
 * <p/>
44
 * <p>Localized here is the logic for handling the veritable smorgasbord
44
 * <p>Localized here is the logic for handling the veritable smorgasbord
45
 * of types supported by &lt;forEach&gt;, including arrays,
45
 * of types supported by &lt;forEach&gt;, including arrays,
46
 * Collections, and others.  To see how the actual iteration is controlled,
46
 * Collections, and others.  To see how the actual iteration is controlled,
47
 * review the javax.servlet.jsp.jstl.core.LoopTagSupport class instead.
47
 * review the javax.servlet.jsp.jstl.core.LoopTagSupport class instead.
48
 * </p>
48
 * </p>
49
 *
49
 *
50
 * @author Shawn Bayern
50
 * @see javax.servlet.jsp.jstl.core.LoopTagSupport
51
 * @see javax.servlet.jsp.jstl.core.LoopTagSupport
51
 * @author Shawn Bayern
52
 */
52
 */
53
53
54
public abstract class ForEachSupport extends LoopTagSupport {
54
public abstract class ForEachSupport extends LoopTagSupport {
Lines 92-99 Link Here
92
     * instead of in advance, would involve changing only those methods that
92
     * instead of in advance, would involve changing only those methods that
93
     * handle primitive arrays.
93
     * handle primitive arrays.
94
     */
94
     */
95
95
    protected static interface ForEachIterator {
96
    protected static interface ForEachIterator {
96
        public boolean hasNext() throws JspTagException;
97
        public boolean hasNext() throws JspTagException;
98
97
        public Object next() throws JspTagException;
99
        public Object next() throws JspTagException;
98
    }
100
    }
99
101
Lines 102-120 Link Here
102
     * an Iterator.  This is appropriate for cases where hasNext() and
104
     * an Iterator.  This is appropriate for cases where hasNext() and
103
     * next() don't need to throw JspTagException.  Such cases are common.core.
105
     * next() don't need to throw JspTagException.  Such cases are common.core.
104
     */
106
     */
107
105
    protected class SimpleForEachIterator implements ForEachIterator {
108
    protected class SimpleForEachIterator implements ForEachIterator {
106
        private Iterator i;
109
        private Iterator i;
110
107
        public SimpleForEachIterator(Iterator i) {
111
        public SimpleForEachIterator(Iterator i) {
108
            this.i = i;
112
            this.i = i;
109
        }
113
        }
114
110
        public boolean hasNext() {
115
        public boolean hasNext() {
111
            return i.hasNext();
116
            return i.hasNext();
112
        }
117
        }
118
113
        public Object next() {
119
        public Object next() {
114
            return i.next();
120
            return i.next();
115
        }
121
        }
116
    }
122
    }
117
    
123
118
    protected class DeferredForEachIterator implements ForEachIterator {
124
    protected class DeferredForEachIterator implements ForEachIterator {
119
125
120
        private ValueExpression itemsValueExpression;
126
        private ValueExpression itemsValueExpression;
Lines 126-146 Link Here
126
        private Iterator myIterator;
132
        private Iterator myIterator;
127
        private boolean anEnumeration = false;
133
        private boolean anEnumeration = false;
128
        private Enumeration myEnumeration;
134
        private Enumeration myEnumeration;
135
129
        public DeferredForEachIterator(ValueExpression o) throws JspTagException {
136
        public DeferredForEachIterator(ValueExpression o) throws JspTagException {
130
            itemsValueExpression = o;
137
            itemsValueExpression = o;
131
            determineLengthAndType();
138
            determineLengthAndType();
132
        }
139
        }
140
133
        public boolean hasNext() throws JspTagException {
141
        public boolean hasNext() throws JspTagException {
134
            if (isIndexedValueExpression) {
142
            if (isIndexedValueExpression) {
135
                if (currentIndex<length) {
143
                if (currentIndex < length) {
136
                    return true;
144
                    return true;
137
                } else {
145
                } else {
138
                    return false;
146
                    return false;
139
                }                
147
                }
140
            } else {
148
            } else {
141
                if (length!=-1) {
149
                if (length != -1) {
142
                    //a Collection, Map, or StringTokenizer 
150
                    //a Collection, Map, or StringTokenizer 
143
                    if (currentIndex<length) {
151
                    if (currentIndex < length) {
144
                        return true;
152
                        return true;
145
                    } else {
153
                    } else {
146
                        return false;
154
                        return false;
Lines 157-174 Link Here
157
                }
165
                }
158
            }
166
            }
159
        }
167
        }
168
160
        public Object next() throws JspTagException {
169
        public Object next() throws JspTagException {
161
            ValueExpression nextValue = null;
170
            ValueExpression nextValue = null;
162
            if (isIndexedValueExpression) {
171
            if (isIndexedValueExpression) {
163
                nextValue = new IndexedValueExpression(itemsValueExpression, currentIndex);
172
                nextValue = new IndexedValueExpression(itemsValueExpression, currentIndex);
164
                currentIndex++;
173
                currentIndex++;
165
            } else {
174
            } else {
166
                if (itemsValueIteratedExpression==null) {
175
                if (itemsValueIteratedExpression == null) {
167
                    itemsValueIteratedExpression = new IteratedExpression(itemsValueExpression, getDelims());
176
                    itemsValueIteratedExpression = new IteratedExpression(itemsValueExpression, getDelims());
168
                }
177
                }
169
                nextValue = new IteratedValueExpression(itemsValueIteratedExpression, currentIndex);
178
                nextValue = new IteratedValueExpression(itemsValueIteratedExpression, currentIndex);
170
                currentIndex++;
179
                currentIndex++;
171
                if (length!=-1) {
180
                if (length != -1) {
172
                    //a Collection, Map, or StringTokenizer
181
                    //a Collection, Map, or StringTokenizer
173
                    //nothing else needed
182
                    //nothing else needed
174
                } else {
183
                } else {
Lines 182-238 Link Here
182
            }
191
            }
183
            return nextValue;
192
            return nextValue;
184
        }
193
        }
194
185
        private void determineLengthAndType() throws JspTagException {
195
        private void determineLengthAndType() throws JspTagException {
186
            ELContext myELContext = pageContext.getELContext();
196
            ELContext myELContext = pageContext.getELContext();
187
            Object o = itemsValueExpression.getValue(myELContext);
197
            Object o = itemsValueExpression.getValue(myELContext);
188
            if (o instanceof Object[]) {
198
            if (o instanceof Object[]) {
189
                length = ((Object[])o).length;
199
                length = ((Object[]) o).length;
190
                isIndexedValueExpression = true;
200
                isIndexedValueExpression = true;
191
            } else if (o instanceof boolean[]) {
201
            } else if (o instanceof boolean[]) {
192
                length = ((boolean[])o).length;
202
                length = ((boolean[]) o).length;
193
                isIndexedValueExpression = true;
203
                isIndexedValueExpression = true;
194
            } else if (o instanceof byte[]) {
204
            } else if (o instanceof byte[]) {
195
                length = ((byte[])o).length;
205
                length = ((byte[]) o).length;
196
                isIndexedValueExpression = true;
206
                isIndexedValueExpression = true;
197
            } else if (o instanceof char[]) {
207
            } else if (o instanceof char[]) {
198
                length = ((char[])o).length;
208
                length = ((char[]) o).length;
199
                isIndexedValueExpression = true;
209
                isIndexedValueExpression = true;
200
            } else if (o instanceof short[]) {
210
            } else if (o instanceof short[]) {
201
                length = ((short[])o).length;
211
                length = ((short[]) o).length;
202
                isIndexedValueExpression = true;
212
                isIndexedValueExpression = true;
203
            } else if (o instanceof int[]) {
213
            } else if (o instanceof int[]) {
204
                length = ((int[])o).length;
214
                length = ((int[]) o).length;
205
                isIndexedValueExpression = true;
215
                isIndexedValueExpression = true;
206
            } else if (o instanceof long[]) {
216
            } else if (o instanceof long[]) {
207
                length = ((long[])o).length;
217
                length = ((long[]) o).length;
208
                isIndexedValueExpression = true;
218
                isIndexedValueExpression = true;
209
            } else if (o instanceof float[]) {
219
            } else if (o instanceof float[]) {
210
                length = ((float[])o).length;
220
                length = ((float[]) o).length;
211
                isIndexedValueExpression = true;
221
                isIndexedValueExpression = true;
212
            } else if (o instanceof double[]) {
222
            } else if (o instanceof double[]) {
213
                length = ((double[])o).length;
223
                length = ((double[]) o).length;
214
                isIndexedValueExpression = true;
224
                isIndexedValueExpression = true;
215
            } else if (o instanceof Collection) {
225
            } else if (o instanceof Collection) {
216
                length = ((Collection)o).size();
226
                length = ((Collection) o).size();
217
                isIndexedValueExpression = false;
227
                isIndexedValueExpression = false;
218
            } else if (o instanceof Iterator) {
228
            } else if (o instanceof Iterator) {
219
                //have to reproduce iterator here so we can determine the size
229
                //have to reproduce iterator here so we can determine the size
220
                isIndexedValueExpression = false;
230
                isIndexedValueExpression = false;
221
                anIterator = true;
231
                anIterator = true;
222
                myIterator = (Iterator)o;
232
                myIterator = (Iterator) o;
223
            } else if (o instanceof Enumeration) {
233
            } else if (o instanceof Enumeration) {
224
                isIndexedValueExpression = false;
234
                isIndexedValueExpression = false;
225
                anEnumeration=true;
235
                anEnumeration = true;
226
                myEnumeration = (Enumeration)o;
236
                myEnumeration = (Enumeration) o;
227
            } else if (o instanceof Map) {
237
            } else if (o instanceof Map) {
228
                length = ((Map)o).size();
238
                length = ((Map) o).size();
229
                isIndexedValueExpression = false;
239
                isIndexedValueExpression = false;
230
            //
240
                //
231
            //else if (o instanceof ResultSet)
241
                //else if (o instanceof ResultSet)
232
            //    items = toForEachIterator((ResultSet) o);
242
                //    items = toForEachIterator((ResultSet) o);
233
            //
243
                //
234
            } else if (o instanceof String) {
244
            } else if (o instanceof String) {
235
                StringTokenizer st = new StringTokenizer((String)o, ",");
245
                StringTokenizer st = new StringTokenizer((String) o, ",");
236
                length = st.countTokens();
246
                length = st.countTokens();
237
                isIndexedValueExpression = false;
247
                isIndexedValueExpression = false;
238
            } else {
248
            } else {
Lines 269-275 Link Here
269
        // produce the right sort of ForEachIterator
279
        // produce the right sort of ForEachIterator
270
        if (rawItems != null) {
280
        if (rawItems != null) {
271
            if (rawItems instanceof ValueExpression) {
281
            if (rawItems instanceof ValueExpression) {
272
                deferredExpression = (ValueExpression)rawItems;
282
                deferredExpression = (ValueExpression) rawItems;
273
                items = toDeferredForEachIterator(deferredExpression);
283
                items = toDeferredForEachIterator(deferredExpression);
274
            } else {
284
            } else {
275
                // extract an iterator over the 'items' we've got
285
                // extract an iterator over the 'items' we've got
Lines 283-290 Link Here
283
        /* ResultSet no more supported in <c:forEach>
293
        /* ResultSet no more supported in <c:forEach>
284
        // step must be 1 when ResultSet is passed in
294
        // step must be 1 when ResultSet is passed in
285
        if (rawItems instanceof ResultSet && step != 1)
295
        if (rawItems instanceof ResultSet && step != 1)
286
            throw new JspTagException(
296
            throw new JspTagException(Resources.getMessage("FOREACH_STEP_NO_RESULTSET"));
287
		Resources.getMessage("FOREACH_STEP_NO_RESULTSET"));
288
        */
297
        */
289
    }
298
    }
290
299
Lines 293-298 Link Here
293
    // Tag logic and lifecycle management
302
    // Tag logic and lifecycle management
294
303
295
    // Releases any resources we may have (or inherit)
304
    // Releases any resources we may have (or inherit)
305
296
    @Override
306
    @Override
297
    public void release() {
307
    public void release() {
298
        super.release();
308
        super.release();
Lines 306-311 Link Here
306
316
307
    /* Extracts a ForEachIterator given an object of a supported type. */
317
    /* Extracts a ForEachIterator given an object of a supported type. */
308
    //This should not be called for a deferred ValueExpression
318
    //This should not be called for a deferred ValueExpression
319
309
    protected ForEachIterator supportedTypeForEachIterator(Object o)
320
    protected ForEachIterator supportedTypeForEachIterator(Object o)
310
            throws JspTagException {
321
            throws JspTagException {
311
322
Lines 325-364 Link Here
325
336
326
        ForEachIterator items;
337
        ForEachIterator items;
327
338
328
        if (o instanceof Object[])
339
        if (o instanceof Object[]) {
329
            items = toForEachIterator((Object[]) o);
340
            items = toForEachIterator((Object[]) o);
330
        else if (o instanceof boolean[])
341
        } else if (o instanceof boolean[]) {
331
            items = toForEachIterator((boolean[]) o);
342
            items = toForEachIterator((boolean[]) o);
332
        else if (o instanceof byte[])
343
        } else if (o instanceof byte[]) {
333
            items = toForEachIterator((byte[]) o);
344
            items = toForEachIterator((byte[]) o);
334
        else if (o instanceof char[])
345
        } else if (o instanceof char[]) {
335
            items = toForEachIterator((char[]) o);
346
            items = toForEachIterator((char[]) o);
336
        else if (o instanceof short[])
347
        } else if (o instanceof short[]) {
337
            items = toForEachIterator((short[]) o);
348
            items = toForEachIterator((short[]) o);
338
        else if (o instanceof int[])
349
        } else if (o instanceof int[]) {
339
            items = toForEachIterator((int[]) o);
350
            items = toForEachIterator((int[]) o);
340
        else if (o instanceof long[])
351
        } else if (o instanceof long[]) {
341
            items = toForEachIterator((long[]) o);
352
            items = toForEachIterator((long[]) o);
342
        else if (o instanceof float[])
353
        } else if (o instanceof float[]) {
343
            items = toForEachIterator((float[]) o);
354
            items = toForEachIterator((float[]) o);
344
        else if (o instanceof double[])
355
        } else if (o instanceof double[]) {
345
            items = toForEachIterator((double[]) o);
356
            items = toForEachIterator((double[]) o);
346
        else if (o instanceof Collection)
357
        } else if (o instanceof Collection) {
347
            items = toForEachIterator((Collection) o);
358
            items = toForEachIterator((Collection) o);
348
        else if (o instanceof Iterator)
359
        } else if (o instanceof Iterator) {
349
            items = toForEachIterator((Iterator) o);
360
            items = toForEachIterator((Iterator) o);
350
        else if (o instanceof Enumeration)
361
        } else if (o instanceof Enumeration) {
351
            items = toForEachIterator((Enumeration) o);
362
            items = toForEachIterator((Enumeration) o);
352
        else if (o instanceof Map)
363
        } else if (o instanceof Map) {
353
            items = toForEachIterator((Map) o);
364
            items = toForEachIterator((Map) o);
365
        }
354
        /*
366
        /*
355
        else if (o instanceof ResultSet)
367
        else if (o instanceof ResultSet)
356
            items = toForEachIterator((ResultSet) o);
368
            items = toForEachIterator((ResultSet) o);
357
        */
369
        */
358
        else if (o instanceof String)
370
        else if (o instanceof String) {
359
            items = toForEachIterator((String) o);
371
            items = toForEachIterator((String) o);
360
        else
372
        } else {
361
            items = toForEachIterator(o);
373
            items = toForEachIterator(o);
374
        }
362
375
363
        return (items);
376
        return (items);
364
    }
377
    }
Lines 368-373 Link Here
368
     * in support of cases where our tag handler isn't passed an
381
     * in support of cases where our tag handler isn't passed an
369
     * explicit collection over which to iterate.
382
     * explicit collection over which to iterate.
370
     */
383
     */
384
371
    private ForEachIterator beginEndForEachIterator() {
385
    private ForEachIterator beginEndForEachIterator() {
372
        /*
386
        /*
373
         * To plug into existing support, we need to keep 'begin', 'end',
387
         * To plug into existing support, we need to keep 'begin', 'end',
Lines 382-389 Link Here
382
         * wouldn't provide much benefit.)
396
         * wouldn't provide much benefit.)
383
         */
397
         */
384
        Integer[] ia = new Integer[end + 1];
398
        Integer[] ia = new Integer[end + 1];
385
        for (int i = 0; i <= end; i++)
399
        for (int i = 0; i <= end; i++) {
386
            ia[i] = new Integer(i);
400
            ia[i] = new Integer(i);
401
        }
387
        return new SimpleForEachIterator(Arrays.asList(ia).iterator());
402
        return new SimpleForEachIterator(Arrays.asList(ia).iterator());
388
    }
403
    }
389
404
Lines 394-412 Link Here
394
    protected ForEachIterator toDeferredForEachIterator(ValueExpression o) throws JspTagException {
409
    protected ForEachIterator toDeferredForEachIterator(ValueExpression o) throws JspTagException {
395
        return new DeferredForEachIterator(o);
410
        return new DeferredForEachIterator(o);
396
    }
411
    }
397
    
412
398
    // catch-all method whose invocation currently signals a 'matching error'
413
    // catch-all method whose invocation currently signals a 'matching error'
414
399
    protected ForEachIterator toForEachIterator(Object o)
415
    protected ForEachIterator toForEachIterator(Object o)
400
            throws JspTagException {
416
            throws JspTagException {
401
        throw new JspTagException(Resources.getMessage("FOREACH_BAD_ITEMS"));
417
        throw new JspTagException(Resources.getMessage("FOREACH_BAD_ITEMS"));
402
    }
418
    }
403
419
404
    // returns an iterator over an Object array (via List)
420
    // returns an iterator over an Object array (via List)
421
405
    protected ForEachIterator toForEachIterator(Object[] a) {
422
    protected ForEachIterator toForEachIterator(Object[] a) {
406
        return new SimpleForEachIterator(Arrays.asList(a).iterator());
423
        return new SimpleForEachIterator(Arrays.asList(a).iterator());
407
    }
424
    }
408
425
409
    // returns an iterator over a boolean[] array, wrapping items in Boolean
426
    // returns an iterator over a boolean[] array, wrapping items in Boolean
427
410
    protected ForEachIterator toForEachIterator(boolean[] a) {
428
    protected ForEachIterator toForEachIterator(boolean[] a) {
411
        Boolean[] wrapped = new Boolean[a.length];
429
        Boolean[] wrapped = new Boolean[a.length];
412
        for (int i = 0; i < a.length; i++) {
430
        for (int i = 0; i < a.length; i++) {
Lines 416-498 Link Here
416
    }
434
    }
417
435
418
    // returns an iterator over a byte[] array, wrapping items in Byte
436
    // returns an iterator over a byte[] array, wrapping items in Byte
437
419
    protected ForEachIterator toForEachIterator(byte[] a) {
438
    protected ForEachIterator toForEachIterator(byte[] a) {
420
        Byte[] wrapped = new Byte[a.length];
439
        Byte[] wrapped = new Byte[a.length];
421
        for (int i = 0; i < a.length; i++)
440
        for (int i = 0; i < a.length; i++) {
422
            wrapped[i] = new Byte(a[i]);
441
            wrapped[i] = new Byte(a[i]);
442
        }
423
        return new SimpleForEachIterator(Arrays.asList(wrapped).iterator());
443
        return new SimpleForEachIterator(Arrays.asList(wrapped).iterator());
424
    }
444
    }
425
445
426
    // returns an iterator over a char[] array, wrapping items in Character
446
    // returns an iterator over a char[] array, wrapping items in Character
447
427
    protected ForEachIterator toForEachIterator(char[] a) {
448
    protected ForEachIterator toForEachIterator(char[] a) {
428
        Character[] wrapped = new Character[a.length];
449
        Character[] wrapped = new Character[a.length];
429
        for (int i = 0; i < a.length; i++)
450
        for (int i = 0; i < a.length; i++) {
430
            wrapped[i] = new Character(a[i]);
451
            wrapped[i] = new Character(a[i]);
452
        }
431
        return new SimpleForEachIterator(Arrays.asList(wrapped).iterator());
453
        return new SimpleForEachIterator(Arrays.asList(wrapped).iterator());
432
    }
454
    }
433
455
434
    // returns an iterator over a short[] array, wrapping items in Short
456
    // returns an iterator over a short[] array, wrapping items in Short
457
435
    protected ForEachIterator toForEachIterator(short[] a) {
458
    protected ForEachIterator toForEachIterator(short[] a) {
436
        Short[] wrapped = new Short[a.length];
459
        Short[] wrapped = new Short[a.length];
437
        for (int i = 0; i < a.length; i++)
460
        for (int i = 0; i < a.length; i++) {
438
            wrapped[i] = new Short(a[i]);
461
            wrapped[i] = new Short(a[i]);
462
        }
439
        return new SimpleForEachIterator(Arrays.asList(wrapped).iterator());
463
        return new SimpleForEachIterator(Arrays.asList(wrapped).iterator());
440
    }
464
    }
441
465
442
    // returns an iterator over an int[] array, wrapping items in Integer
466
    // returns an iterator over an int[] array, wrapping items in Integer
467
443
    protected ForEachIterator toForEachIterator(int[] a) {
468
    protected ForEachIterator toForEachIterator(int[] a) {
444
        Integer[] wrapped = new Integer[a.length];
469
        Integer[] wrapped = new Integer[a.length];
445
        for (int i = 0; i < a.length; i++)
470
        for (int i = 0; i < a.length; i++) {
446
            wrapped[i] = new Integer(a[i]);
471
            wrapped[i] = new Integer(a[i]);
472
        }
447
        return new SimpleForEachIterator(Arrays.asList(wrapped).iterator());
473
        return new SimpleForEachIterator(Arrays.asList(wrapped).iterator());
448
    }
474
    }
449
475
450
    // returns an iterator over a long[] array, wrapping items in Long
476
    // returns an iterator over a long[] array, wrapping items in Long
477
451
    protected ForEachIterator toForEachIterator(long[] a) {
478
    protected ForEachIterator toForEachIterator(long[] a) {
452
        Long[] wrapped = new Long[a.length];
479
        Long[] wrapped = new Long[a.length];
453
        for (int i = 0; i < a.length; i++)
480
        for (int i = 0; i < a.length; i++) {
454
            wrapped[i] = new Long(a[i]);
481
            wrapped[i] = new Long(a[i]);
482
        }
455
        return new SimpleForEachIterator(Arrays.asList(wrapped).iterator());
483
        return new SimpleForEachIterator(Arrays.asList(wrapped).iterator());
456
    }
484
    }
457
485
458
    // returns an iterator over a float[] array, wrapping items in Float
486
    // returns an iterator over a float[] array, wrapping items in Float
487
459
    protected ForEachIterator toForEachIterator(float[] a) {
488
    protected ForEachIterator toForEachIterator(float[] a) {
460
        Float[] wrapped = new Float[a.length];
489
        Float[] wrapped = new Float[a.length];
461
        for (int i = 0; i < a.length; i++)
490
        for (int i = 0; i < a.length; i++) {
462
            wrapped[i] = new Float(a[i]);
491
            wrapped[i] = new Float(a[i]);
492
        }
463
        return new SimpleForEachIterator(Arrays.asList(wrapped).iterator());
493
        return new SimpleForEachIterator(Arrays.asList(wrapped).iterator());
464
    }
494
    }
465
495
466
    // returns an iterator over a double[] array, wrapping items in Double
496
    // returns an iterator over a double[] array, wrapping items in Double
497
467
    protected ForEachIterator toForEachIterator(double[] a) {
498
    protected ForEachIterator toForEachIterator(double[] a) {
468
        Double[] wrapped = new Double[a.length];
499
        Double[] wrapped = new Double[a.length];
469
        for (int i = 0; i < a.length; i++)
500
        for (int i = 0; i < a.length; i++) {
470
            wrapped[i] = new Double(a[i]);
501
            wrapped[i] = new Double(a[i]);
502
        }
471
        return new SimpleForEachIterator(Arrays.asList(wrapped).iterator());
503
        return new SimpleForEachIterator(Arrays.asList(wrapped).iterator());
472
    }
504
    }
473
505
474
    // retrieves an iterator from a Collection
506
    // retrieves an iterator from a Collection
507
475
    protected ForEachIterator toForEachIterator(Collection c) {
508
    protected ForEachIterator toForEachIterator(Collection c) {
476
        return new SimpleForEachIterator(c.iterator());
509
        return new SimpleForEachIterator(c.iterator());
477
    }
510
    }
478
511
479
    // simply passes an Iterator through...
512
    // simply passes an Iterator through...
513
480
    protected ForEachIterator toForEachIterator(Iterator i) {
514
    protected ForEachIterator toForEachIterator(Iterator i) {
481
        return new SimpleForEachIterator(i);
515
        return new SimpleForEachIterator(i);
482
    }
516
    }
483
517
484
    // converts an Enumeration to an Iterator via a local adapter
518
    // converts an Enumeration to an Iterator via a local adapter
519
485
    protected ForEachIterator toForEachIterator(Enumeration e) {
520
    protected ForEachIterator toForEachIterator(Enumeration e) {
486
521
487
        // local adapter
522
        // local adapter
488
        class EnumerationAdapter implements ForEachIterator {
523
        class EnumerationAdapter implements ForEachIterator {
489
            private Enumeration e;
524
            private Enumeration e;
525
490
            public EnumerationAdapter(Enumeration e) {
526
            public EnumerationAdapter(Enumeration e) {
491
                this.e = e;
527
                this.e = e;
492
            }
528
            }
529
493
            public boolean hasNext() {
530
            public boolean hasNext() {
494
                return e.hasMoreElements();
531
                return e.hasMoreElements();
495
            }
532
            }
533
496
            public Object next() {
534
            public Object next() {
497
                return e.nextElement();
535
                return e.nextElement();
498
            }
536
            }
Lines 502-507 Link Here
502
    }
540
    }
503
541
504
    // retrieves an iterator over the Map.Entry items in a Map
542
    // retrieves an iterator over the Map.Entry items in a Map
543
505
    protected ForEachIterator toForEachIterator(Map m) {
544
    protected ForEachIterator toForEachIterator(Map m) {
506
        return new SimpleForEachIterator(m.entrySet().iterator());
545
        return new SimpleForEachIterator(m.entrySet().iterator());
507
    }
546
    }
Lines 539-544 Link Here
539
    */
578
    */
540
579
541
    // tokenizes a String as a CSV and returns an iterator over it
580
    // tokenizes a String as a CSV and returns an iterator over it
581
542
    protected ForEachIterator toForEachIterator(String s) {
582
    protected ForEachIterator toForEachIterator(String s) {
543
        StringTokenizer st = new StringTokenizer(s, ",");
583
        StringTokenizer st = new StringTokenizer(s, ",");
544
        return toForEachIterator(st);           // convert from Enumeration
584
        return toForEachIterator(st);           // convert from Enumeration
(-)src/main/java/org/apache/taglibs/standard/tag/common/core/OtherwiseTag.java (-1 / +2 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tag.common.core;
18
package org.apache.taglibs.standard.tag.common.core;
19
19
Lines 32-37 Link Here
32
     */
32
     */
33
33
34
    // Don't let the condition stop us... :-)
34
    // Don't let the condition stop us... :-)
35
35
    @Override
36
    @Override
36
    protected boolean condition() {
37
    protected boolean condition() {
37
        return true;
38
        return true;
(-)src/main/java/org/apache/taglibs/standard/tag/common/core/ImportSupport.java (-299 / +359 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tag.common.core;
18
package org.apache.taglibs.standard.tag.common.core;
19
19
Lines 56-115 Link Here
56
 * @author Shawn Bayern
56
 * @author Shawn Bayern
57
 */
57
 */
58
58
59
public abstract class ImportSupport extends BodyTagSupport 
59
public abstract class ImportSupport extends BodyTagSupport
60
        implements TryCatchFinally, ParamParent {
60
        implements TryCatchFinally, ParamParent {
61
61
62
    //*********************************************************************
62
    //*********************************************************************
63
    // Public constants
63
    // Public constants
64
    
64
65
    /** <p>Valid characters in a scheme.</p>
65
    /**
66
     *  <p>RFC 1738 says the following:</p>
66
     * <p>Valid characters in a scheme.</p>
67
     *  <blockquote>
67
     * <p>RFC 1738 says the following:</p>
68
     *   Scheme names consist of a sequence of characters. The lower
68
     * <blockquote>
69
     *   case letters "a"--"z", digits, and the characters plus ("+"),
69
     * Scheme names consist of a sequence of characters. The lower
70
     *   period ("."), and hyphen ("-") are allowed. For resiliency,
70
     * case letters "a"--"z", digits, and the characters plus ("+"),
71
     *   programs interpreting URLs should treat upper case letters as
71
     * period ("."), and hyphen ("-") are allowed. For resiliency,
72
     *   equivalent to lower case in scheme names (e.g., allow "HTTP" as
72
     * programs interpreting URLs should treat upper case letters as
73
     *   well as "http").
73
     * equivalent to lower case in scheme names (e.g., allow "HTTP" as
74
     *  </blockquote>
74
     * well as "http").
75
     * </blockquote>
75
     * <p>We treat as absolute any URL that begins with such a scheme name,
76
     * <p>We treat as absolute any URL that begins with such a scheme name,
76
     * followed by a colon.</p>
77
     * followed by a colon.</p>
77
     */
78
     */
78
    public static final String VALID_SCHEME_CHARS =
79
    public static final String VALID_SCHEME_CHARS =
79
	"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+.-";
80
            "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+.-";
80
81
81
    /** Default character encoding for response. */
82
    /**
83
     * Default character encoding for response.
84
     */
82
    public static final String DEFAULT_ENCODING = "ISO-8859-1";
85
    public static final String DEFAULT_ENCODING = "ISO-8859-1";
83
86
84
    //*********************************************************************
87
    //*********************************************************************
85
    // Protected state
88
    // Protected state
86
89
87
    protected String url;                         // 'url' attribute
90
    protected String url;                         // 'url' attribute
88
    protected String context;			  // 'context' attribute
91
    protected String context;              // 'context' attribute
89
    protected String charEncoding;                // 'charEncoding' attrib.
92
    protected String charEncoding;                // 'charEncoding' attrib.
90
93
91
    //*********************************************************************
94
    //*********************************************************************
92
    // Private state (implementation details)
95
    // Private state (implementation details)
93
96
94
    private String var;                 // 'var' attribute
97
    private String var;                 // 'var' attribute
95
    private int scope;			// processed 'scope' attribute
98
    private int scope;            // processed 'scope' attribute
96
    private String varReader;           // 'varReader' attribute
99
    private String varReader;           // 'varReader' attribute
97
    private Reader r;	 		// exposed reader, if relevant
100
    private Reader r;             // exposed reader, if relevant
98
    private boolean isAbsoluteUrl;	// is our URL absolute?
101
    private boolean isAbsoluteUrl;    // is our URL absolute?
99
    private ParamSupport.ParamManager params;    // parameters
102
    private ParamSupport.ParamManager params;    // parameters
100
    private String urlWithParams;	// URL with parameters, if applicable
103
    private String urlWithParams;    // URL with parameters, if applicable
101
104
102
    //*********************************************************************
105
    //*********************************************************************
103
    // Constructor and initialization
106
    // Constructor and initialization
104
107
105
    public ImportSupport() {
108
    public ImportSupport() {
106
	super();
109
        super();
107
	init();
110
        init();
108
    }
111
    }
109
112
110
    private void init() {
113
    private void init() {
111
	url = var = varReader = context = charEncoding = urlWithParams = null;
114
        url = var = varReader = context = charEncoding = urlWithParams = null;
112
	params = null;
115
        params = null;
113
        scope = PageContext.PAGE_SCOPE;
116
        scope = PageContext.PAGE_SCOPE;
114
    }
117
    }
115
118
Lines 118-199 Link Here
118
    // Tag logic
121
    // Tag logic
119
122
120
    // determines what kind of import and variable exposure to perform 
123
    // determines what kind of import and variable exposure to perform 
124
121
    @Override
125
    @Override
122
    public int doStartTag() throws JspException {
126
    public int doStartTag() throws JspException {
123
	// Sanity check
127
        // Sanity check
124
	if (context != null
128
        if (context != null
125
	        && (!context.startsWith("/") || !url.startsWith("/"))) {
129
                && (!context.startsWith("/") || !url.startsWith("/"))) {
126
	    throw new JspTagException(
130
            throw new JspTagException(
127
		Resources.getMessage("IMPORT_BAD_RELATIVE"));
131
                    Resources.getMessage("IMPORT_BAD_RELATIVE"));
128
	}
132
        }
129
133
130
	// reset parameter-related state
134
        // reset parameter-related state
131
	urlWithParams = null;
135
        urlWithParams = null;
132
	params = new ParamSupport.ParamManager();
136
        params = new ParamSupport.ParamManager();
133
137
134
	// check the URL
138
        // check the URL
135
	if (url == null || url.equals(""))
139
        if (url == null || url.equals("")) {
136
	    throw new NullAttributeException("import", "url");
140
            throw new NullAttributeException("import", "url");
141
        }
137
142
138
	// Record whether our URL is absolute or relative
143
        // Record whether our URL is absolute or relative
139
	isAbsoluteUrl = isAbsoluteUrl();
144
        isAbsoluteUrl = isAbsoluteUrl();
140
145
141
	try {
146
        try {
142
	    // If we need to expose a Reader, we've got to do it right away
147
            // If we need to expose a Reader, we've got to do it right away
143
	    if  (varReader != null) {
148
            if (varReader != null) {
144
	        r = acquireReader();
149
                r = acquireReader();
145
	        pageContext.setAttribute(varReader, r);
150
                pageContext.setAttribute(varReader, r);
146
	    }
151
            }
147
	} catch (IOException ex) {
152
        } catch (IOException ex) {
148
	    throw new JspTagException(ex.toString(), ex);
153
            throw new JspTagException(ex.toString(), ex);
149
	}
154
        }
150
155
151
	return EVAL_BODY_INCLUDE;
156
        return EVAL_BODY_INCLUDE;
152
    }
157
    }
153
158
154
    // manages connections as necessary (creating or destroying)
159
    // manages connections as necessary (creating or destroying)
160
155
    @Override
161
    @Override
156
    public int doEndTag() throws JspException {
162
    public int doEndTag() throws JspException {
157
        try {
163
        try {
158
	    // If we didn't expose a Reader earlier...
164
            // If we didn't expose a Reader earlier...
159
	    if (varReader == null) {
165
            if (varReader == null) {
160
	        // ... store it in 'var', if available ...
166
                // ... store it in 'var', if available ...
161
	        if (var != null)
167
                if (var != null) {
162
	            pageContext.setAttribute(var, acquireString(), scope);
168
                    pageContext.setAttribute(var, acquireString(), scope);
169
                }
163
                // ... or simply output it, if we have nowhere to expose it
170
                // ... or simply output it, if we have nowhere to expose it
164
	        else
171
                else {
165
	            pageContext.getOut().print(acquireString());
172
                    pageContext.getOut().print(acquireString());
166
	    }
173
                }
167
	    return EVAL_PAGE;
174
            }
175
            return EVAL_PAGE;
168
        } catch (IOException ex) {
176
        } catch (IOException ex) {
169
	    throw new JspTagException(ex.toString(), ex);
177
            throw new JspTagException(ex.toString(), ex);
170
        }
178
        }
171
    }
179
    }
172
180
173
    // simply rethrows its exception
181
    // simply rethrows its exception
182
174
    public void doCatch(Throwable t) throws Throwable {
183
    public void doCatch(Throwable t) throws Throwable {
175
	throw t;
184
        throw t;
176
    }
185
    }
177
186
178
    // cleans up if appropriate
187
    // cleans up if appropriate
179
    public void doFinally() { 
188
189
    public void doFinally() {
180
        try {
190
        try {
181
	    // If we exposed a Reader in doStartTag(), close it.
191
            // If we exposed a Reader in doStartTag(), close it.
182
	    if (varReader != null) {
192
            if (varReader != null) {
183
		// 'r' can be null if an exception was thrown...
193
                // 'r' can be null if an exception was thrown...
184
	        if (r != null)
194
                if (r != null) {
185
		    r.close();
195
                    r.close();
186
		pageContext.removeAttribute(varReader, PageContext.PAGE_SCOPE);
196
                }
187
	    }
197
                pageContext.removeAttribute(varReader, PageContext.PAGE_SCOPE);
198
            }
188
        } catch (IOException ex) {
199
        } catch (IOException ex) {
189
	    // ignore it; close() failed, but there's nothing more we can do
200
            // ignore it; close() failed, but there's nothing more we can do
190
        }
201
        }
191
    }
202
    }
192
203
193
    // Releases any resources we may have (or inherit)
204
    // Releases any resources we may have (or inherit)
205
194
    @Override
206
    @Override
195
    public void release() {
207
    public void release() {
196
	init();
208
        init();
197
        super.release();
209
        super.release();
198
    }
210
    }
199
211
Lines 201-215 Link Here
201
    // Tag attributes known at translation time
213
    // Tag attributes known at translation time
202
214
203
    public void setVar(String var) {
215
    public void setVar(String var) {
204
	this.var = var;
216
        this.var = var;
205
    }
217
    }
206
218
207
    public void setVarReader(String varReader) {
219
    public void setVarReader(String varReader) {
208
	this.varReader = varReader;
220
        this.varReader = varReader;
209
    }
221
    }
210
222
211
    public void setScope(String scope) {
223
    public void setScope(String scope) {
212
	this.scope = Util.getScope(scope);
224
        this.scope = Util.getScope(scope);
213
    }
225
    }
214
226
215
227
Lines 217-224 Link Here
217
    // Collaboration with subtags
229
    // Collaboration with subtags
218
230
219
    // inherit Javadoc
231
    // inherit Javadoc
232
220
    public void addParameter(String name, String value) {
233
    public void addParameter(String name, String value) {
221
	params.addParameter(name, value);
234
        params.addParameter(name, value);
222
    }
235
    }
223
236
224
    //*********************************************************************
237
    //*********************************************************************
Lines 241-358 Link Here
241
     */
254
     */
242
255
243
    private String acquireString() throws IOException, JspException {
256
    private String acquireString() throws IOException, JspException {
244
	if (isAbsoluteUrl) {
257
        if (isAbsoluteUrl) {
245
	    // for absolute URLs, delegate to our peer
258
            // for absolute URLs, delegate to our peer
246
	    BufferedReader r = new BufferedReader(acquireReader());
259
            BufferedReader r = new BufferedReader(acquireReader());
247
	    StringBuffer sb = new StringBuffer();
260
            StringBuffer sb = new StringBuffer();
248
	    int i;
261
            int i;
249
262
250
	    // under JIT, testing seems to show this simple loop is as fast
263
            // under JIT, testing seems to show this simple loop is as fast
251
	    // as any of the alternatives
264
            // as any of the alternatives
252
	    while ((i = r.read()) != -1)
265
            while ((i = r.read()) != -1) {
253
	        sb.append((char)i);
266
                sb.append((char) i);
267
            }
254
268
255
	    return sb.toString();
269
            return sb.toString();
256
	} else { 
270
        } else {
257
	    // handle relative URLs ourselves
271
            // handle relative URLs ourselves
258
272
259
	    // URL is relative, so we must be an HTTP request
273
            // URL is relative, so we must be an HTTP request
260
	    if (!(pageContext.getRequest() instanceof HttpServletRequest
274
            if (!(pageContext.getRequest() instanceof HttpServletRequest
261
		  && pageContext.getResponse() instanceof HttpServletResponse))
275
                    && pageContext.getResponse() instanceof HttpServletResponse)) {
262
		throw new JspTagException(
276
                throw new JspTagException(
263
		    Resources.getMessage("IMPORT_REL_WITHOUT_HTTP"));
277
                        Resources.getMessage("IMPORT_REL_WITHOUT_HTTP"));
278
            }
264
279
265
	    // retrieve an appropriate ServletContext
280
            // retrieve an appropriate ServletContext
266
	    ServletContext c = null;
281
            ServletContext c = null;
267
	    String targetUrl = targetUrl();
282
            String targetUrl = targetUrl();
268
	    if (context != null)
283
            if (context != null) {
269
	        c = pageContext.getServletContext().getContext(context);
284
                c = pageContext.getServletContext().getContext(context);
270
	    else {
285
            } else {
271
	        c = pageContext.getServletContext();
286
                c = pageContext.getServletContext();
272
287
273
		// normalize the URL if we have an HttpServletRequest
288
                // normalize the URL if we have an HttpServletRequest
274
		if (!targetUrl.startsWith("/")) {
289
                if (!targetUrl.startsWith("/")) {
275
		    String sp = ((HttpServletRequest) 
290
                    String sp = ((HttpServletRequest)
276
			pageContext.getRequest()).getServletPath();
291
                            pageContext.getRequest()).getServletPath();
277
		    targetUrl = sp.substring(0, sp.lastIndexOf('/'))
292
                    targetUrl = sp.substring(0, sp.lastIndexOf('/'))
278
			+ '/' + targetUrl;
293
                            + '/' + targetUrl;
279
		}
294
                }
280
	    }
295
            }
281
296
282
            if (c == null) {
297
            if (c == null) {
283
                throw new JspTagException(
298
                throw new JspTagException(
284
                    Resources.getMessage(
299
                        Resources.getMessage(
285
                        "IMPORT_REL_WITHOUT_DISPATCHER", context, targetUrl));
300
                                "IMPORT_REL_WITHOUT_DISPATCHER", context, targetUrl));
286
            }
301
            }
287
302
288
	    // from this context, get a dispatcher
303
            // from this context, get a dispatcher
289
	    RequestDispatcher rd =
304
            RequestDispatcher rd =
290
                c.getRequestDispatcher(stripSession(targetUrl));
305
                    c.getRequestDispatcher(stripSession(targetUrl));
291
	    if (rd == null)
306
            if (rd == null) {
292
		throw new JspTagException(stripSession(targetUrl));
307
                throw new JspTagException(stripSession(targetUrl));
308
            }
293
309
294
	    // include the resource, using our custom wrapper
310
            // include the resource, using our custom wrapper
295
	    ImportResponseWrapper irw = 
311
            ImportResponseWrapper irw =
296
		new ImportResponseWrapper(
312
                    new ImportResponseWrapper(
297
		    (HttpServletResponse) pageContext.getResponse());
313
                            (HttpServletResponse) pageContext.getResponse());
298
314
299
            ImportRequestWrapper wrappedRequest = 
315
            ImportRequestWrapper wrappedRequest =
300
		new ImportRequestWrapper(
316
                    new ImportRequestWrapper(
301
		    (HttpServletRequest) pageContext.getRequest());
317
                            (HttpServletRequest) pageContext.getRequest());
302
318
303
	    // spec mandates specific error handling form include()
319
            // spec mandates specific error handling form include()
304
	    try {
320
            try {
305
	        rd.include(wrappedRequest, irw);
321
                rd.include(wrappedRequest, irw);
306
	    } catch (IOException ex) {
322
            } catch (IOException ex) {
307
		throw new JspException(ex);
323
                throw new JspException(ex);
308
	    } catch (RuntimeException ex) {
324
            } catch (RuntimeException ex) {
309
		throw new JspException(ex);
325
                throw new JspException(ex);
310
	    } catch (ServletException ex) {
326
            } catch (ServletException ex) {
311
		Throwable rc = ex.getRootCause();
327
                Throwable rc = ex.getRootCause();
312
        while (rc instanceof ServletException) {
328
                while (rc instanceof ServletException) {
313
            rc = ((ServletException) rc).getRootCause();
329
                    rc = ((ServletException) rc).getRootCause();
314
        }
330
                }
315
		if (rc == null)
331
                if (rc == null) {
316
		    throw new JspException(ex);
332
                    throw new JspException(ex);
317
		else
333
                } else {
318
		    throw new JspException(rc);
334
                    throw new JspException(rc);
319
	    }
335
                }
336
            }
320
337
321
	    // disallow inappropriate response codes per JSTL spec
338
            // disallow inappropriate response codes per JSTL spec
322
	    if (irw.getStatus() < 200 || irw.getStatus() > 299) {
339
            if (irw.getStatus() < 200 || irw.getStatus() > 299) {
323
		throw new JspTagException(irw.getStatus() + " " +
340
                throw new JspTagException(irw.getStatus() + " " +
324
		    stripSession(targetUrl));
341
                        stripSession(targetUrl));
325
	    }
342
            }
326
343
327
	    // recover the response String from our wrapper
344
            // recover the response String from our wrapper
328
	    return irw.getString();
345
            return irw.getString();
329
	}
346
        }
330
    }
347
    }
331
348
332
    private Reader acquireReader() throws IOException, JspException {
349
    private Reader acquireReader() throws IOException, JspException {
333
	if (!isAbsoluteUrl) {
350
        if (!isAbsoluteUrl) {
334
	    // for relative URLs, delegate to our peer
351
            // for relative URLs, delegate to our peer
335
	    return new StringReader(acquireString());
352
            return new StringReader(acquireString());
336
	} else {
353
        } else {
337
            // absolute URL
354
            // absolute URL
338
            String target = targetUrl();
355
            String target = targetUrl();
339
	    try {
356
            try {
340
	        // handle absolute URLs ourselves, using java.net.URL
357
                // handle absolute URLs ourselves, using java.net.URL
341
	        URL u = new URL(target);
358
                URL u = new URL(target);
342
                URLConnection uc = u.openConnection();
359
                URLConnection uc = u.openConnection();
343
                InputStream i = uc.getInputStream();
360
                InputStream i = uc.getInputStream();
344
361
345
	        // okay, we've got a stream; encode it appropriately
362
                // okay, we've got a stream; encode it appropriately
346
	        Reader r = null;
363
                Reader r = null;
347
                String charSet; 
364
                String charSet;
348
	        if (charEncoding != null && !charEncoding.equals("")) {
365
                if (charEncoding != null && !charEncoding.equals("")) {
349
                    charSet = charEncoding;
366
                    charSet = charEncoding;
350
                } else {
367
                } else {
351
                    // charSet extracted according to RFC 2045, section 5.1
368
                    // charSet extracted according to RFC 2045, section 5.1
352
		    String contentType = uc.getContentType();
369
                    String contentType = uc.getContentType();
353
		    if (contentType != null) {
370
                    if (contentType != null) {
354
                        charSet = Util.getContentTypeAttribute(contentType, "charset");
371
                        charSet = Util.getContentTypeAttribute(contentType, "charset");
355
                        if (charSet == null) charSet = DEFAULT_ENCODING;
372
                        if (charSet == null) {
373
                            charSet = DEFAULT_ENCODING;
374
                        }
356
                    } else {
375
                    } else {
357
                        charSet = DEFAULT_ENCODING;
376
                        charSet = DEFAULT_ENCODING;
358
                    }
377
                    }
Lines 363-394 Link Here
363
                    r = new InputStreamReader(i, DEFAULT_ENCODING);
382
                    r = new InputStreamReader(i, DEFAULT_ENCODING);
364
                }
383
                }
365
384
366
		// check response code for HTTP URLs before returning, per spec,
385
                // check response code for HTTP URLs before returning, per spec,
367
		// before returning
386
                // before returning
368
		if (uc instanceof HttpURLConnection) {
387
                if (uc instanceof HttpURLConnection) {
369
		    int status = ((HttpURLConnection) uc).getResponseCode();
388
                    int status = ((HttpURLConnection) uc).getResponseCode();
370
		    if (status < 200 || status > 299)
389
                    if (status < 200 || status > 299) {
371
			throw new JspTagException(status + " " + target);
390
                        throw new JspTagException(status + " " + target);
372
		}
391
                    }
392
                }
373
393
374
	        return r;
394
                return r;
375
	    } catch (IOException ex) {
395
            } catch (IOException ex) {
376
		throw new JspException(
396
                throw new JspException(
377
                    Resources.getMessage("IMPORT_ABS_ERROR", target, ex), ex);
397
                        Resources.getMessage("IMPORT_ABS_ERROR", target, ex), ex);
378
	    } catch (RuntimeException ex) {  // because the spec makes us
398
            } catch (RuntimeException ex) {  // because the spec makes us
379
		throw new JspException(
399
                throw new JspException(
380
                    Resources.getMessage("IMPORT_ABS_ERROR", target, ex), ex);
400
                        Resources.getMessage("IMPORT_ABS_ERROR", target, ex), ex);
381
	    }
401
            }
382
	}
402
        }
383
    }
403
    }
384
404
385
    /** Wraps requests to allow us to enforce the method to be GET */
405
    /**
406
     * Wraps requests to allow us to enforce the method to be GET
407
     */
386
    private class ImportRequestWrapper extends HttpServletRequestWrapper {
408
    private class ImportRequestWrapper extends HttpServletRequestWrapper {
387
409
388
        public ImportRequestWrapper(HttpServletRequest request) {
410
        public ImportRequestWrapper(HttpServletRequest request) {
389
            super(request);
411
            super(request);
390
        }
412
        }
391
        
413
392
        @Override
414
        @Override
393
        public String getMethod() {
415
        public String getMethod() {
394
            return "GET";
416
            return "GET";
Lines 396-529 Link Here
396
418
397
    }
419
    }
398
420
399
    /** Wraps responses to allow us to retrieve results as Strings. */
421
    /**
422
     * Wraps responses to allow us to retrieve results as Strings.
423
     */
400
    private class ImportResponseWrapper extends HttpServletResponseWrapper {
424
    private class ImportResponseWrapper extends HttpServletResponseWrapper {
401
425
402
	//************************************************************
426
        //************************************************************
403
	// Overview
427
        // Overview
404
428
405
	/*
429
        /*
406
	 * We provide either a Writer or an OutputStream as requested.
430
       * We provide either a Writer or an OutputStream as requested.
407
	 * We actually have a true Writer and an OutputStream backing
431
       * We actually have a true Writer and an OutputStream backing
408
	 * both, since we don't want to use a character encoding both
432
       * both, since we don't want to use a character encoding both
409
	 * ways (Writer -> OutputStream -> Writer).  So we use no
433
       * ways (Writer -> OutputStream -> Writer).  So we use no
410
	 * encoding at all (as none is relevant) when the target resource
434
       * encoding at all (as none is relevant) when the target resource
411
	 * uses a Writer.  And we decode the OutputStream's bytes
435
       * uses a Writer.  And we decode the OutputStream's bytes
412
	 * using OUR tag's 'charEncoding' attribute, or ISO-8859-1
436
       * using OUR tag's 'charEncoding' attribute, or ISO-8859-1
413
	 * as the default.  We thus ignore setLocale() and setContentType()
437
       * as the default.  We thus ignore setLocale() and setContentType()
414
	 * in this wrapper.
438
       * in this wrapper.
415
	 *
439
       *
416
	 * In other words, the target's asserted encoding is used
440
       * In other words, the target's asserted encoding is used
417
	 * to convert from a Writer to an OutputStream, which is typically
441
       * to convert from a Writer to an OutputStream, which is typically
418
	 * the medium through with the target will communicate its
442
       * the medium through with the target will communicate its
419
	 * ultimate response.  Since we short-circuit that mechanism
443
       * ultimate response.  Since we short-circuit that mechanism
420
	 * and read the target's characters directly if they're offered
444
       * and read the target's characters directly if they're offered
421
	 * as such, we simply ignore the target's encoding assertion.
445
       * as such, we simply ignore the target's encoding assertion.
422
	 */
446
       */
423
447
424
	//************************************************************
448
        //************************************************************
425
	// Data
449
        // Data
426
450
427
	/** The Writer we convey. */
451
        /**
428
	private StringWriter sw = new StringWriter();
452
         * The Writer we convey.
453
         */
454
        private StringWriter sw = new StringWriter();
429
455
430
	/** A buffer, alternatively, to accumulate bytes. */
456
        /**
431
	private ByteArrayOutputStream bos = new ByteArrayOutputStream();
457
         * A buffer, alternatively, to accumulate bytes.
458
         */
459
        private ByteArrayOutputStream bos = new ByteArrayOutputStream();
432
460
433
	/** A ServletOutputStream we convey, tied to this Writer. */
461
        /**
434
	private ServletOutputStream sos = new ServletOutputStream() {
462
         * A ServletOutputStream we convey, tied to this Writer.
435
	    @Override
463
         */
436
        public void write(int b) throws IOException {
464
        private ServletOutputStream sos = new ServletOutputStream() {
437
		bos.write(b);
465
            @Override
438
	    }
466
            public void write(int b) throws IOException {
439
	};
467
                bos.write(b);
468
            }
469
        };
440
470
441
	/** 'True' if getWriter() was called; false otherwise. */
471
        /**
442
	private boolean isWriterUsed;
472
         * 'True' if getWriter() was called; false otherwise.
473
         */
474
        private boolean isWriterUsed;
443
475
444
	/** 'True if getOutputStream() was called; false otherwise. */
476
        /**
445
	private boolean isStreamUsed;
477
         * 'True if getOutputStream() was called; false otherwise.
478
         */
479
        private boolean isStreamUsed;
446
480
447
	/** The HTTP status set by the target. */
481
        /**
448
	private int status = 200;
482
         * The HTTP status set by the target.
449
	
483
         */
450
	//************************************************************
484
        private int status = 200;
451
	// Constructor and methods
452
485
453
	/** Constructs a new ImportResponseWrapper. */
486
        //************************************************************
454
	public ImportResponseWrapper(HttpServletResponse response) {
487
        // Constructor and methods
455
	    super(response);
456
	}
457
	
458
	/** Returns a Writer designed to buffer the output. */
459
	@Override
460
    public PrintWriter getWriter() {
461
	    if (isStreamUsed)
462
		throw new IllegalStateException(
463
		    Resources.getMessage("IMPORT_ILLEGAL_STREAM"));
464
	    isWriterUsed = true;
465
	    return new PrintWriter(sw);
466
	}
467
	
468
	/** Returns a ServletOutputStream designed to buffer the output. */
469
	@Override
470
    public ServletOutputStream getOutputStream() {
471
	    if (isWriterUsed)
472
		throw new IllegalStateException(
473
		    Resources.getMessage("IMPORT_ILLEGAL_WRITER"));
474
	    isStreamUsed = true;
475
	    return sos;
476
	}
477
488
478
	/** Has no effect. */
489
        /**
479
	@Override
490
         * Constructs a new ImportResponseWrapper.
480
    public void setContentType(String x) {
491
         */
481
	    // ignore
492
        public ImportResponseWrapper(HttpServletResponse response) {
482
	}
493
            super(response);
494
        }
483
495
484
	/** Has no effect. */
496
        /**
485
	@Override
497
         * Returns a Writer designed to buffer the output.
486
    public void setLocale(Locale x) {
498
         */
487
	    // ignore
499
        @Override
488
	}
500
        public PrintWriter getWriter() {
501
            if (isStreamUsed) {
502
                throw new IllegalStateException(
503
                        Resources.getMessage("IMPORT_ILLEGAL_STREAM"));
504
            }
505
            isWriterUsed = true;
506
            return new PrintWriter(sw);
507
        }
489
508
490
	@Override
509
        /**
491
    public void setStatus(int status) {
510
         * Returns a ServletOutputStream designed to buffer the output.
492
	    this.status = status;
511
         */
493
	}
512
        @Override
513
        public ServletOutputStream getOutputStream() {
514
            if (isWriterUsed) {
515
                throw new IllegalStateException(
516
                        Resources.getMessage("IMPORT_ILLEGAL_WRITER"));
517
            }
518
            isStreamUsed = true;
519
            return sos;
520
        }
494
521
495
	public int getStatus() {
522
        /**
496
	    return status;
523
         * Has no effect.
497
	}
524
         */
525
        @Override
526
        public void setContentType(String x) {
527
            // ignore
528
        }
498
529
499
	/** 
530
        /**
500
	 * Retrieves the buffered output, using the containing tag's 
531
         * Has no effect.
501
	 * 'charEncoding' attribute, or the tag's default encoding,
502
	 * <b>if necessary</b>.
503
         */
532
         */
504
	// not simply toString() because we need to throw
533
        @Override
505
	// UnsupportedEncodingException
534
        public void setLocale(Locale x) {
506
	public String getString() throws UnsupportedEncodingException {
535
            // ignore
507
	    if (isWriterUsed)
536
        }
508
		return sw.toString();
537
509
	    else if (isStreamUsed) {
538
        @Override
510
		if (charEncoding != null && !charEncoding.equals(""))
539
        public void setStatus(int status) {
511
		    return bos.toString(charEncoding);
540
            this.status = status;
512
		else
541
        }
513
		    return bos.toString(DEFAULT_ENCODING);
542
514
	    } else
543
        public int getStatus() {
515
		return "";		// target didn't write anything
544
            return status;
516
	}
545
        }
546
547
        /**
548
         * Retrieves the buffered output, using the containing tag's
549
         * 'charEncoding' attribute, or the tag's default encoding,
550
         * <b>if necessary</b>.
551
         */
552
        // not simply toString() because we need to throw
553
        // UnsupportedEncodingException
554
        public String getString() throws UnsupportedEncodingException {
555
            if (isWriterUsed) {
556
                return sw.toString();
557
            } else if (isStreamUsed) {
558
                if (charEncoding != null && !charEncoding.equals("")) {
559
                    return bos.toString(charEncoding);
560
                } else {
561
                    return bos.toString(DEFAULT_ENCODING);
562
                }
563
            } else {
564
                return "";
565
            }        // target didn't write anything
566
        }
517
    }
567
    }
518
568
519
    //*********************************************************************
569
    //*********************************************************************
520
    // Some private utility methods
570
    // Some private utility methods
521
571
522
    /** Returns our URL (potentially with parameters) */
572
    /**
573
     * Returns our URL (potentially with parameters)
574
     */
523
    private String targetUrl() {
575
    private String targetUrl() {
524
	if (urlWithParams == null)
576
        if (urlWithParams == null) {
525
	    urlWithParams = params.aggregateParams(url);
577
            urlWithParams = params.aggregateParams(url);
526
	return urlWithParams;
578
        }
579
        return urlWithParams;
527
    }
580
    }
528
581
529
    /**
582
    /**
Lines 543-565 Link Here
543
     * <tt>false</tt> otherwise.
596
     * <tt>false</tt> otherwise.
544
     */
597
     */
545
    public static boolean isAbsoluteUrl(String url) {
598
    public static boolean isAbsoluteUrl(String url) {
546
	// a null URL is not absolute, by our definition
599
        // a null URL is not absolute, by our definition
547
	if (url == null)
600
        if (url == null) {
548
	    return false;
601
            return false;
602
        }
549
603
550
	// do a fast, simple check first
604
        // do a fast, simple check first
551
	int colonPos;
605
        int colonPos;
552
	if ((colonPos = url.indexOf(":")) == -1)
606
        if ((colonPos = url.indexOf(":")) == -1) {
553
	    return false;
607
            return false;
608
        }
554
609
555
	// if we DO have a colon, make sure that every character
610
        // if we DO have a colon, make sure that every character
556
	// leading up to it is a valid scheme character
611
        // leading up to it is a valid scheme character
557
	for (int i = 0; i < colonPos; i++)
612
        for (int i = 0; i < colonPos; i++) {
558
	    if (VALID_SCHEME_CHARS.indexOf(url.charAt(i)) == -1)
613
            if (VALID_SCHEME_CHARS.indexOf(url.charAt(i)) == -1) {
559
		return false;
614
                return false;
615
            }
616
        }
560
617
561
	// if so, we've got an absolute url
618
        // if so, we've got an absolute url
562
	return true;
619
        return true;
563
    }
620
    }
564
621
565
    /**
622
    /**
Lines 569-582 Link Here
569
     * and either EOS or a subsequent ';' (exclusive).
626
     * and either EOS or a subsequent ';' (exclusive).
570
     */
627
     */
571
    public static String stripSession(String url) {
628
    public static String stripSession(String url) {
572
	StringBuffer u = new StringBuffer(url);
629
        StringBuffer u = new StringBuffer(url);
573
        int sessionStart;
630
        int sessionStart;
574
        while ((sessionStart = u.toString().indexOf(";jsessionid=")) != -1) {
631
        while ((sessionStart = u.toString().indexOf(";jsessionid=")) != -1) {
575
            int sessionEnd = u.toString().indexOf(";", sessionStart + 1);
632
            int sessionEnd = u.toString().indexOf(";", sessionStart + 1);
576
            if (sessionEnd == -1)
633
            if (sessionEnd == -1) {
577
		sessionEnd = u.toString().indexOf("?", sessionStart + 1);
634
                sessionEnd = u.toString().indexOf("?", sessionStart + 1);
578
	    if (sessionEnd == -1) 				// still
635
            }
636
            if (sessionEnd == -1)                 // still
637
            {
579
                sessionEnd = u.length();
638
                sessionEnd = u.length();
639
            }
580
            u.delete(sessionStart, sessionEnd);
640
            u.delete(sessionStart, sessionEnd);
581
        }
641
        }
582
        return u.toString();
642
        return u.toString();
(-)src/main/java/org/apache/taglibs/standard/tag/common/core/ForTokensSupport.java (-6 / +7 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tag.common.core;
18
package org.apache.taglibs.standard.tag.common.core;
19
19
Lines 33-40 Link Here
33
 * expression-evaluating libraries each have handlers that extend this
33
 * expression-evaluating libraries each have handlers that extend this
34
 * class.</p>
34
 * class.</p>
35
 *
35
 *
36
 * @author Shawn Bayern
36
 * @see javax.servlet.jsp.jstl.core.LoopTagSupport
37
 * @see javax.servlet.jsp.jstl.core.LoopTagSupport
37
 * @author Shawn Bayern
38
 */
38
 */
39
39
40
public abstract class ForTokensSupport extends LoopTagSupport {
40
public abstract class ForTokensSupport extends LoopTagSupport {
Lines 76-87 Link Here
76
            ELContext myELContext = pageContext.getELContext();
76
            ELContext myELContext = pageContext.getELContext();
77
            Object originalValue = deferredExpression.getValue(myELContext);
77
            Object originalValue = deferredExpression.getValue(myELContext);
78
            if (originalValue instanceof String) {
78
            if (originalValue instanceof String) {
79
                st = new StringTokenizer((String)originalValue, delims);
79
                st = new StringTokenizer((String) originalValue, delims);
80
            } else {
80
            } else {
81
                throw new JspTagException();
81
                throw new JspTagException();
82
            }
82
            }
83
        } else {
83
        } else {
84
            st = new StringTokenizer((String)items, delims);
84
            st = new StringTokenizer((String) items, delims);
85
        }
85
        }
86
    }
86
    }
87
87
Lines 92-100 Link Here
92
92
93
    @Override
93
    @Override
94
    protected Object next() throws JspTagException {
94
    protected Object next() throws JspTagException {
95
        if (deferredExpression!=null) {
95
        if (deferredExpression != null) {
96
            st.nextElement();
96
            st.nextElement();
97
            if (itemsValueIteratedExpression==null) {
97
            if (itemsValueIteratedExpression == null) {
98
                itemsValueIteratedExpression = new IteratedExpression(deferredExpression, getDelims());
98
                itemsValueIteratedExpression = new IteratedExpression(deferredExpression, getDelims());
99
            }
99
            }
100
            ValueExpression nextValue = new IteratedValueExpression(itemsValueIteratedExpression, currentIndex);
100
            ValueExpression nextValue = new IteratedValueExpression(itemsValueIteratedExpression, currentIndex);
Lines 111-116 Link Here
111
111
112
112
113
    // Releases any resources we may have (or inherit)
113
    // Releases any resources we may have (or inherit)
114
114
    @Override
115
    @Override
115
    public void release() {
116
    public void release() {
116
        super.release();
117
        super.release();
(-)src/main/java/org/apache/taglibs/standard/tag/common/core/ParamParent.java (-1 / +1 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tag.common.core;
18
package org.apache.taglibs.standard.tag.common.core;
19
19
(-)src/main/java/org/apache/taglibs/standard/tag/common/core/ChooseTag.java (-5 / +9 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tag.common.core;
18
package org.apache.taglibs.standard.tag.common.core;
19
19
Lines 24-30 Link Here
24
24
25
/**
25
/**
26
 * <p>Tag handler for &lt;choose&gt; in JSTL.</p>
26
 * <p>Tag handler for &lt;choose&gt; in JSTL.</p>
27
 * 
27
 * <p/>
28
 * <p>&lt;choose&gt; is a very simple tag that acts primarily as a container;
28
 * <p>&lt;choose&gt; is a very simple tag that acts primarily as a container;
29
 * it always includes its body and allows exactly one of its child
29
 * it always includes its body and allows exactly one of its child
30
 * &lt;when&gt; tags to run.  Since this tag handler doesn't have any
30
 * &lt;when&gt; tags to run.  Since this tag handler doesn't have any
Lines 40-51 Link Here
40
    // Constructor and lifecycle management
40
    // Constructor and lifecycle management
41
41
42
    // initialize inherited and local state
42
    // initialize inherited and local state
43
43
    public ChooseTag() {
44
    public ChooseTag() {
44
        super();
45
        super();
45
        init();
46
        init();
46
    }
47
    }
47
48
48
    // Releases any resources we may have (or inherit)
49
    // Releases any resources we may have (or inherit)
50
49
    @Override
51
    @Override
50
    public void release() {
52
    public void release() {
51
        super.release();
53
        super.release();
Lines 77-85 Link Here
77
     * body.
79
     * body.
78
     */
80
     */
79
    public synchronized void subtagSucceeded() {
81
    public synchronized void subtagSucceeded() {
80
        if (subtagGateClosed)
82
        if (subtagGateClosed) {
81
            throw new IllegalStateException(
83
            throw new IllegalStateException(
82
		Resources.getMessage("CHOOSE_EXCLUSIVITY"));
84
                    Resources.getMessage("CHOOSE_EXCLUSIVITY"));
85
        }
83
        subtagGateClosed = true;
86
        subtagGateClosed = true;
84
    }
87
    }
85
88
Lines 88-96 Link Here
88
    // Tag logic
91
    // Tag logic
89
92
90
    // always include body
93
    // always include body
94
91
    @Override
95
    @Override
92
    public int doStartTag() throws JspException {
96
    public int doStartTag() throws JspException {
93
        subtagGateClosed = false;	// when we start, no children have run
97
        subtagGateClosed = false;    // when we start, no children have run
94
        return EVAL_BODY_INCLUDE;
98
        return EVAL_BODY_INCLUDE;
95
    }
99
    }
96
100
(-)src/main/java/org/apache/taglibs/standard/tag/common/core/NullAttributeException.java (-2 / +2 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tag.common.core;
18
package org.apache.taglibs.standard.tag.common.core;
19
19
Lines 38-43 Link Here
38
     * @param att The attribute value for which the error occurred.
38
     * @param att The attribute value for which the error occurred.
39
     */
39
     */
40
    public NullAttributeException(String tag, String att) {
40
    public NullAttributeException(String tag, String att) {
41
	super(Resources.getMessage("TAG_NULL_ATTRIBUTE", att, tag));
41
        super(Resources.getMessage("TAG_NULL_ATTRIBUTE", att, tag));
42
    }
42
    }
43
}
43
}
(-)src/main/java/org/apache/taglibs/standard/tag/common/core/Util.java (-45 / +57 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tag.common.core;
18
package org.apache.taglibs.standard.tag.common.core;
19
19
Lines 34-42 Link Here
34
 */
34
 */
35
public class Util {
35
public class Util {
36
36
37
    private static final String REQUEST = "request";   
37
    private static final String REQUEST = "request";
38
    private static final String SESSION = "session";   
38
    private static final String SESSION = "session";
39
    private static final String APPLICATION = "application"; 
39
    private static final String APPLICATION = "application";
40
    private static final String DEFAULT = "default";
40
    private static final String DEFAULT = "default";
41
    private static final String SHORT = "short";
41
    private static final String SHORT = "short";
42
    private static final String MEDIUM = "medium";
42
    private static final String MEDIUM = "medium";
Lines 54-70 Link Here
54
     *
54
     *
55
     * @return PageContext constant corresponding to given scope description
55
     * @return PageContext constant corresponding to given scope description
56
     */
56
     */
57
57
    public static int getScope(String scope) {
58
    public static int getScope(String scope) {
58
	int ret = PageContext.PAGE_SCOPE; // default
59
        int ret = PageContext.PAGE_SCOPE; // default
59
60
60
	if (REQUEST.equalsIgnoreCase(scope))
61
        if (REQUEST.equalsIgnoreCase(scope)) {
61
	    ret = PageContext.REQUEST_SCOPE;
62
            ret = PageContext.REQUEST_SCOPE;
62
	else if (SESSION.equalsIgnoreCase(scope))
63
        } else if (SESSION.equalsIgnoreCase(scope)) {
63
	    ret = PageContext.SESSION_SCOPE;
64
            ret = PageContext.SESSION_SCOPE;
64
	else if (APPLICATION.equalsIgnoreCase(scope))
65
        } else if (APPLICATION.equalsIgnoreCase(scope)) {
65
	    ret = PageContext.APPLICATION_SCOPE;
66
            ret = PageContext.APPLICATION_SCOPE;
67
        }
66
68
67
	return ret;
69
        return ret;
68
    }
70
    }
69
71
70
    /*
72
    /*
Lines 78-104 Link Here
78
     *
80
     *
79
     * @throws JspException if the given style is invalid
81
     * @throws JspException if the given style is invalid
80
     */
82
     */
83
81
    public static int getStyle(String style, String errCode)
84
    public static int getStyle(String style, String errCode)
82
	                throws JspException {
85
            throws JspException {
83
	int ret = DateFormat.DEFAULT;
86
        int ret = DateFormat.DEFAULT;
84
87
85
	if (style != null) {
88
        if (style != null) {
86
	    if (DEFAULT.equalsIgnoreCase(style)) {
89
            if (DEFAULT.equalsIgnoreCase(style)) {
87
		ret = DateFormat.DEFAULT;
90
                ret = DateFormat.DEFAULT;
88
	    } else if (SHORT.equalsIgnoreCase(style)) {
91
            } else if (SHORT.equalsIgnoreCase(style)) {
89
		ret = DateFormat.SHORT;
92
                ret = DateFormat.SHORT;
90
	    } else if (MEDIUM.equalsIgnoreCase(style)) {
93
            } else if (MEDIUM.equalsIgnoreCase(style)) {
91
		ret = DateFormat.MEDIUM;
94
                ret = DateFormat.MEDIUM;
92
	    } else if (LONG.equalsIgnoreCase(style)) {
95
            } else if (LONG.equalsIgnoreCase(style)) {
93
		ret = DateFormat.LONG;
96
                ret = DateFormat.LONG;
94
	    } else if (FULL.equalsIgnoreCase(style)) {
97
            } else if (FULL.equalsIgnoreCase(style)) {
95
		ret = DateFormat.FULL;
98
                ret = DateFormat.FULL;
96
	    } else {
99
            } else {
97
		throw new JspException(Resources.getMessage(errCode, style));
100
                throw new JspException(Resources.getMessage(errCode, style));
98
	    }
101
            }
99
	}
102
        }
100
103
101
	return ret;
104
        return ret;
102
    }
105
    }
103
106
104
107
Lines 107-154 Link Here
107
     * Syntax defined in RFC 2045, section 5.1.
110
     * Syntax defined in RFC 2045, section 5.1.
108
     */
111
     */
109
    public static String getContentTypeAttribute(String input, String name) {
112
    public static String getContentTypeAttribute(String input, String name) {
110
	int begin;
113
        int begin;
111
	int end;
114
        int end;
112
        int index = input.toUpperCase().indexOf(name.toUpperCase());
115
        int index = input.toUpperCase().indexOf(name.toUpperCase());
113
        if (index == -1) return null;
116
        if (index == -1) {
117
            return null;
118
        }
114
        index = index + name.length(); // positioned after the attribute name
119
        index = index + name.length(); // positioned after the attribute name
115
        index = input.indexOf('=', index); // positioned at the '='
120
        index = input.indexOf('=', index); // positioned at the '='
116
        if (index == -1) return null;
121
        if (index == -1) {
122
            return null;
123
        }
117
        index += 1; // positioned after the '='
124
        index += 1; // positioned after the '='
118
        input = input.substring(index).trim();
125
        input = input.substring(index).trim();
119
        
126
120
        if (input.charAt(0) == '"') {
127
        if (input.charAt(0) == '"') {
121
            // attribute value is a quoted string
128
            // attribute value is a quoted string
122
            begin = 1;
129
            begin = 1;
123
            end = input.indexOf('"', begin);
130
            end = input.indexOf('"', begin);
124
            if (end == -1) return null;
131
            if (end == -1) {
132
                return null;
133
            }
125
        } else {
134
        } else {
126
            begin = 0;
135
            begin = 0;
127
            end = input.indexOf(';');
136
            end = input.indexOf(';');
128
            if (end == -1) end = input.indexOf(' ');
137
            if (end == -1) {
129
            if (end == -1) end = input.length();
138
                end = input.indexOf(' ');
139
            }
140
            if (end == -1) {
141
                end = input.length();
142
            }
130
        }
143
        }
131
        return input.substring(begin, end).trim();
144
        return input.substring(begin, end).trim();
132
    }
145
    }
133
146
134
    /**
147
    /**
135
     * HttpServletRequest.getLocales() returns the server's default locale 
148
     * HttpServletRequest.getLocales() returns the server's default locale
136
     * if the request did not specify a preferred language.
149
     * if the request did not specify a preferred language.
137
     * We do not want this behavior, because it prevents us from using
150
     * We do not want this behavior, because it prevents us from using
138
     * the fallback locale. 
151
     * the fallback locale.
139
     * We therefore need to return an empty Enumeration if no preferred 
152
     * We therefore need to return an empty Enumeration if no preferred
140
     * locale has been specified. This way, the logic for the fallback 
153
     * locale has been specified. This way, the logic for the fallback
141
     * locale will be able to kick in.
154
     * locale will be able to kick in.
142
     */
155
     */
143
    public static Enumeration getRequestLocales(HttpServletRequest request) {        
156
    public static Enumeration getRequestLocales(HttpServletRequest request) {
144
        Enumeration values = request.getHeaders("accept-language");
157
        Enumeration values = request.getHeaders("accept-language");
145
        if (values == null) {
158
        if (values == null) {
146
            // No header for "accept-language". Simply return
159
            // No header for "accept-language". Simply return
147
            // a new empty enumeration.
160
            // a new empty enumeration.
148
            // System.out.println("Null accept-language");
161
            // System.out.println("Null accept-language");
149
            return new Vector().elements();
162
            return new Vector().elements();
150
        } else
163
        } else if (values.hasMoreElements()) {
151
        if (values.hasMoreElements()) {
152
            // At least one "accept-language". Simply return
164
            // At least one "accept-language". Simply return
153
            // the enumeration returned by request.getLocales().
165
            // the enumeration returned by request.getLocales().
154
            // System.out.println("At least one accept-language");
166
            // System.out.println("At least one accept-language");
(-)src/main/java/org/apache/taglibs/standard/tag/common/core/CatchTag.java (-5 / +9 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tag.common.core;
18
package org.apache.taglibs.standard.tag.common.core;
19
19
Lines 23-29 Link Here
23
23
24
/**
24
/**
25
 * <p>Tag handler for &lt;catch&gt; in JSTL 1.0.</p>
25
 * <p>Tag handler for &lt;catch&gt; in JSTL 1.0.</p>
26
 * 
26
 * <p/>
27
 * <p>&lt;catch&gt; simply catches any Throwables that occur in its body
27
 * <p>&lt;catch&gt; simply catches any Throwables that occur in its body
28
 * and optionally exposes them.
28
 * and optionally exposes them.
29
 *
29
 *
Lines 41-52 Link Here
41
    // Constructor and lifecycle management
41
    // Constructor and lifecycle management
42
42
43
    // initialize inherited and local state
43
    // initialize inherited and local state
44
44
    public CatchTag() {
45
    public CatchTag() {
45
        super();
46
        super();
46
        init();
47
        init();
47
    }
48
    }
48
49
49
    // Releases any resources we may have (or inherit)
50
    // Releases any resources we may have (or inherit)
51
50
    @Override
52
    @Override
51
    public void release() {
53
    public void release() {
52
        super.release();
54
        super.release();
Lines 71-88 Link Here
71
    @Override
73
    @Override
72
    public int doStartTag() {
74
    public int doStartTag() {
73
        caught = false;
75
        caught = false;
74
	return EVAL_BODY_INCLUDE;
76
        return EVAL_BODY_INCLUDE;
75
    }
77
    }
76
78
77
    public void doCatch(Throwable t) {
79
    public void doCatch(Throwable t) {
78
        if (var != null)
80
        if (var != null) {
79
            pageContext.setAttribute(var, t, PageContext.PAGE_SCOPE);
81
            pageContext.setAttribute(var, t, PageContext.PAGE_SCOPE);
82
        }
80
        caught = true;
83
        caught = true;
81
    }
84
    }
82
85
83
    public void doFinally() {
86
    public void doFinally() {
84
        if (var != null && !caught)
87
        if (var != null && !caught) {
85
            pageContext.removeAttribute(var, PageContext.PAGE_SCOPE);
88
            pageContext.removeAttribute(var, PageContext.PAGE_SCOPE);
89
        }
86
    }
90
    }
87
91
88
92
(-)src/main/java/org/apache/taglibs/standard/tag/common/core/SetSupport.java (-17 / +14 lines)
Lines 13-43 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tag.common.core;
18
package org.apache.taglibs.standard.tag.common.core;
19
19
20
import java.beans.IntrospectionException;
20
import java.beans.IntrospectionException;
21
import java.beans.Introspector;
21
import java.beans.Introspector;
22
import java.beans.PropertyDescriptor;
22
import java.beans.PropertyDescriptor;
23
24
import java.lang.reflect.InvocationTargetException;
23
import java.lang.reflect.InvocationTargetException;
25
import java.lang.reflect.Method;
24
import java.lang.reflect.Method;
26
27
import java.util.Map;
25
import java.util.Map;
28
26
27
import javax.el.ELContext;
28
import javax.el.ELException;
29
import javax.el.ExpressionFactory;
30
import javax.el.ValueExpression;
31
import javax.el.VariableMapper;
29
import javax.servlet.jsp.JspApplicationContext;
32
import javax.servlet.jsp.JspApplicationContext;
30
import javax.servlet.jsp.JspException;
33
import javax.servlet.jsp.JspException;
31
import javax.servlet.jsp.JspFactory;
34
import javax.servlet.jsp.JspFactory;
32
import javax.servlet.jsp.JspTagException;
35
import javax.servlet.jsp.JspTagException;
33
import javax.servlet.jsp.PageContext;
36
import javax.servlet.jsp.PageContext;
34
35
import javax.el.ELException;
36
import javax.el.ELContext;
37
import javax.el.ValueExpression;
38
import javax.el.VariableMapper;
39
import javax.el.ExpressionFactory;
40
41
import javax.servlet.jsp.tagext.BodyTagSupport;
37
import javax.servlet.jsp.tagext.BodyTagSupport;
42
38
43
import org.apache.taglibs.standard.resources.Resources;
39
import org.apache.taglibs.standard.resources.Resources;
Lines 68-73 Link Here
68
    }
64
    }
69
65
70
    // Releases any resources we may have (or inherit)
66
    // Releases any resources we may have (or inherit)
67
71
    @Override
68
    @Override
72
    public void release() {
69
    public void release() {
73
        var = null;
70
        var = null;
Lines 172-178 Link Here
172
                if (scopeValue != PageContext.PAGE_SCOPE) {
169
                if (scopeValue != PageContext.PAGE_SCOPE) {
173
                    throw new JspTagException(Resources.getMessage("SET_BAD_DEFERRED_SCOPE", scope));
170
                    throw new JspTagException(Resources.getMessage("SET_BAD_DEFERRED_SCOPE", scope));
174
                }
171
                }
175
                vm.setVariable(var, (ValueExpression)result);
172
                vm.setVariable(var, (ValueExpression) result);
176
            } else {
173
            } else {
177
                // make sure to remove it from the VariableMapper if we will be setting into page scope
174
                // make sure to remove it from the VariableMapper if we will be setting into page scope
178
                if (scopeValue == PageContext.PAGE_SCOPE && vm.resolveVariable(var) != null) {
175
                if (scopeValue == PageContext.PAGE_SCOPE && vm.resolveVariable(var) != null) {
Lines 182-188 Link Here
182
            }
179
            }
183
        } else {
180
        } else {
184
            //make sure to remove it from the Var mapper
181
            //make sure to remove it from the Var mapper
185
            if (vm.resolveVariable(var)!=null) {
182
            if (vm.resolveVariable(var) != null) {
186
                vm.setVariable(var, null);
183
                vm.setVariable(var, null);
187
            }
184
            }
188
            if (scope != null) {
185
            if (scope != null) {
Lines 196-204 Link Here
196
    /**
193
    /**
197
     * Export the result into a Map.
194
     * Export the result into a Map.
198
     *
195
     *
199
     * @param target the Map to export into
196
     * @param target   the Map to export into
200
     * @param property the key to export into
197
     * @param property the key to export into
201
     * @param result the value to export
198
     * @param result   the value to export
202
     */
199
     */
203
    void exportToMapProperty(Object target, String property, Object result) {
200
    void exportToMapProperty(Object target, String property, Object result) {
204
        @SuppressWarnings("unchecked")
201
        @SuppressWarnings("unchecked")
Lines 213-221 Link Here
213
    /**
210
    /**
214
     * Export the result into a bean property.
211
     * Export the result into a bean property.
215
     *
212
     *
216
     * @param target the bean to export into
213
     * @param target   the bean to export into
217
     * @param property the bean property to set
214
     * @param property the bean property to set
218
     * @param result the value to export
215
     * @param result   the value to export
219
     * @throws JspTagException if there was a problem exporting the result
216
     * @throws JspTagException if there was a problem exporting the result
220
     */
217
     */
221
    void exportToBeanProperty(Object target, String property, Object result) throws JspTagException {
218
    void exportToBeanProperty(Object target, String property, Object result) throws JspTagException {
Lines 252-258 Link Here
252
     * rules of the Expression Language.
249
     * rules of the Expression Language.
253
     *
250
     *
254
     * @param value the value to convert
251
     * @param value the value to convert
255
     * @param m the setter method
252
     * @param m     the setter method
256
     * @return value converted to an instance of the expected type; will be null if value was null
253
     * @return value converted to an instance of the expected type; will be null if value was null
257
     * @throws javax.el.ELException if there was a problem coercing the value
254
     * @throws javax.el.ELException if there was a problem coercing the value
258
     */
255
     */
(-)src/main/java/org/apache/taglibs/standard/tag/common/core/RemoveTag.java (-9 / +15 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tag.common.core;
18
package org.apache.taglibs.standard.tag.common.core;
19
19
Lines 32-40 Link Here
32
    //*********************************************************************
32
    //*********************************************************************
33
    // Internal state
33
    // Internal state
34
34
35
    private int scope;					// tag attribute
35
    private int scope;                    // tag attribute
36
    private boolean scopeSpecified;			// ... by tag attribute
36
    private boolean scopeSpecified;            // ... by tag attribute
37
    private String var;					// tag attribute
37
    private String var;                    // tag attribute
38
38
39
39
40
    //*********************************************************************
40
    //*********************************************************************
Lines 51-56 Link Here
51
    }
51
    }
52
52
53
    // resets local state
53
    // resets local state
54
54
    private void init() {
55
    private void init() {
55
        var = null;
56
        var = null;
56
        scope = PageContext.PAGE_SCOPE;
57
        scope = PageContext.PAGE_SCOPE;
Lines 58-63 Link Here
58
    }
59
    }
59
60
60
    // Releases any resources we may have (or inherit)
61
    // Releases any resources we may have (or inherit)
62
61
    @Override
63
    @Override
62
    public void release() {
64
    public void release() {
63
        super.release();
65
        super.release();
Lines 69-81 Link Here
69
    // Tag logic
71
    // Tag logic
70
72
71
    // removes the variable (from a specific scope, if specified)
73
    // removes the variable (from a specific scope, if specified)
74
72
    @Override
75
    @Override
73
    public int doEndTag() throws JspException {
76
    public int doEndTag() throws JspException {
74
        if (!scopeSpecified)
77
        if (!scopeSpecified) {
75
            pageContext.removeAttribute(var);
78
            pageContext.removeAttribute(var);
76
        else
79
        } else {
77
            pageContext.removeAttribute(var, scope);
80
            pageContext.removeAttribute(var, scope);
78
	return EVAL_PAGE;
81
        }
82
        return EVAL_PAGE;
79
    }
83
    }
80
84
81
85
Lines 83-95 Link Here
83
    // Accessor methods
87
    // Accessor methods
84
88
85
    // for tag attribute
89
    // for tag attribute
90
86
    public void setVar(String var) {
91
    public void setVar(String var) {
87
	this.var = var;
92
        this.var = var;
88
    }
93
    }
89
94
90
    // for tag attribute
95
    // for tag attribute
96
91
    public void setScope(String scope) {
97
    public void setScope(String scope) {
92
        this.scope = Util.getScope(scope);
98
        this.scope = Util.getScope(scope);
93
	scopeSpecified = true;
99
        scopeSpecified = true;
94
    }
100
    }
95
}
101
}
(-)src/main/java/org/apache/taglibs/standard/tag/common/core/WhenTagSupport.java (-12 / +15 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tag.common.core;
18
package org.apache.taglibs.standard.tag.common.core;
19
19
Lines 29-46 Link Here
29
 * implementation of &lt;when&gt;-style tags in both the rtexprvalue
29
 * implementation of &lt;when&gt;-style tags in both the rtexprvalue
30
 * and expression-evaluating libraries.  It also supports
30
 * and expression-evaluating libraries.  It also supports
31
 * &lt;otherwise&gt;.</p>
31
 * &lt;otherwise&gt;.</p>
32
 *
32
 * <p/>
33
 * <p>In particular, this base class does the following:</p>
33
 * <p>In particular, this base class does the following:</p>
34
 * 
34
 * <p/>
35
 * <ul>
35
 * <ul>
36
 *  <li> overrides ConditionalTagSupport.doStartTag() to implement the
36
 * <li> overrides ConditionalTagSupport.doStartTag() to implement the
37
 *       appropriate semantics of subtags of &lt;choose&gt; </li>
37
 * appropriate semantics of subtags of &lt;choose&gt; </li>
38
 * </ul>
38
 * </ul>
39
 *
39
 *
40
 * @author Shawn Bayern
40
 * @author Shawn Bayern
41
 */
41
 */
42
public abstract class WhenTagSupport extends ConditionalTagSupport
42
public abstract class WhenTagSupport extends ConditionalTagSupport {
43
{
44
    //*********************************************************************
43
    //*********************************************************************
45
    // Implementation of exclusive-conditional behavior
44
    // Implementation of exclusive-conditional behavior
46
45
Lines 49-73 Link Here
49
     * ChooseTag wants it to do so.  The condition will not even be
48
     * ChooseTag wants it to do so.  The condition will not even be
50
     * evaluated if ChooseTag instructs us not to run.
49
     * evaluated if ChooseTag instructs us not to run.
51
     */
50
     */
51
52
    @Override
52
    @Override
53
    public int doStartTag() throws JspException {
53
    public int doStartTag() throws JspException {
54
54
55
        Tag parent;
55
        Tag parent;
56
56
57
        // make sure we're contained properly
57
        // make sure we're contained properly
58
        if (!((parent = getParent()) instanceof ChooseTag))
58
        if (!((parent = getParent()) instanceof ChooseTag)) {
59
            throw new JspTagException(
59
            throw new JspTagException(
60
		Resources.getMessage("WHEN_OUTSIDE_CHOOSE"));
60
                    Resources.getMessage("WHEN_OUTSIDE_CHOOSE"));
61
        }
61
62
62
        // make sure our parent wants us to continue
63
        // make sure our parent wants us to continue
63
        if (!((ChooseTag) parent).gainPermission())
64
        if (!((ChooseTag) parent).gainPermission()) {
64
            return SKIP_BODY;                   // we've been reeled in
65
            return SKIP_BODY;
66
        }                   // we've been reeled in
65
67
66
        // handle conditional behavior
68
        // handle conditional behavior
67
        if (condition()) {
69
        if (condition()) {
68
            ((ChooseTag) parent).subtagSucceeded();
70
            ((ChooseTag) parent).subtagSucceeded();
69
            return EVAL_BODY_INCLUDE;
71
            return EVAL_BODY_INCLUDE;
70
        } else
72
        } else {
71
            return SKIP_BODY;
73
            return SKIP_BODY;
74
        }
72
    }
75
    }
73
}
76
}
(-)src/main/java/org/apache/taglibs/standard/tag/common/core/DeclareTag.java (-3 / +5 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tag.common.core;
18
package org.apache.taglibs.standard.tag.common.core;
19
19
Lines 24-30 Link Here
24
 * essentially a runtime no-op as far as tag logic is concerned; the
24
 * essentially a runtime no-op as far as tag logic is concerned; the
25
 * only important functionality of the tag is to expose a scripting
25
 * only important functionality of the tag is to expose a scripting
26
 * variable for an existing scoped attribute.</p>
26
 * variable for an existing scoped attribute.</p>
27
 * 
27
 *
28
 * @author Shawn Bayern
28
 * @author Shawn Bayern
29
 */
29
 */
30
30
Lines 34-38 Link Here
34
     * We're not identical to TagSupport only because we need to
34
     * We're not identical to TagSupport only because we need to
35
     * accept an additional "type" attribute.
35
     * accept an additional "type" attribute.
36
     */
36
     */
37
    public void setType(String x) { }
37
38
    public void setType(String x) {
39
    }
38
}
40
}
(-)src/main/java/org/apache/taglibs/standard/tag/common/core/ParamSupport.java (-74 / +85 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tag.common.core;
18
package org.apache.taglibs.standard.tag.common.core;
19
19
Lines 33-40 Link Here
33
 * <p>Support for tag handlers for &lt;param&gt;, the URL parameter
33
 * <p>Support for tag handlers for &lt;param&gt;, the URL parameter
34
 * subtag for &lt;import&gt; in JSTL 1.0.</p>
34
 * subtag for &lt;import&gt; in JSTL 1.0.</p>
35
 *
35
 *
36
 * @author Shawn Bayern
36
 * @see ParamParent, ImportSupport, URLEncodeSupport
37
 * @see ParamParent, ImportSupport, URLEncodeSupport
37
 * @author Shawn Bayern
38
 */
38
 */
39
39
40
public abstract class ParamSupport extends BodyTagSupport {
40
public abstract class ParamSupport extends BodyTagSupport {
Lines 56-93 Link Here
56
    // Constructor and initialization
56
    // Constructor and initialization
57
57
58
    public ParamSupport() {
58
    public ParamSupport() {
59
	super();
59
        super();
60
	init();
60
        init();
61
    }
61
    }
62
62
63
    private void init() {
63
    private void init() {
64
	name = value = null;
64
        name = value = null;
65
    }
65
    }
66
66
67
    //*********************************************************************
67
    //*********************************************************************
68
    // Tag logic
68
    // Tag logic
69
69
70
    // simply send our name and value to our appropriate ancestor
70
    // simply send our name and value to our appropriate ancestor
71
71
    @Override
72
    @Override
72
    public int doEndTag() throws JspException {
73
    public int doEndTag() throws JspException {
73
	Tag t = findAncestorWithClass(this, ParamParent.class);
74
        Tag t = findAncestorWithClass(this, ParamParent.class);
74
	if (t == null)
75
        if (t == null) {
75
	    throw new JspTagException(
76
            throw new JspTagException(
76
		Resources.getMessage("PARAM_OUTSIDE_PARENT"));
77
                    Resources.getMessage("PARAM_OUTSIDE_PARENT"));
78
        }
77
79
78
	// take no action for null or empty names
80
        // take no action for null or empty names
79
	if (name == null || name.equals(""))
81
        if (name == null || name.equals("")) {
80
	    return EVAL_PAGE;
82
            return EVAL_PAGE;
83
        }
81
84
82
	// send the parameter to the appropriate ancestor
85
        // send the parameter to the appropriate ancestor
83
	ParamParent parent = (ParamParent) t;
86
        ParamParent parent = (ParamParent) t;
84
	String value = this.value;
87
        String value = this.value;
85
	if (value == null) {
88
        if (value == null) {
86
	    if (bodyContent == null || bodyContent.getString() == null)
89
            if (bodyContent == null || bodyContent.getString() == null) {
87
		value = "";
90
                value = "";
88
	    else
91
            } else {
89
		value = bodyContent.getString().trim();
92
                value = bodyContent.getString().trim();
90
	}
93
            }
94
        }
91
        if (encode) {
95
        if (encode) {
92
            String enc = pageContext.getResponse().getCharacterEncoding();
96
            String enc = pageContext.getResponse().getCharacterEncoding();
93
            try {
97
            try {
Lines 98-184 Link Here
98
        } else {
102
        } else {
99
            parent.addParameter(name, value);
103
            parent.addParameter(name, value);
100
        }
104
        }
101
	return EVAL_PAGE;
105
        return EVAL_PAGE;
102
    }
106
    }
103
107
104
    // Releases any resources we may have (or inherit)
108
    // Releases any resources we may have (or inherit)
109
105
    @Override
110
    @Override
106
    public void release() {
111
    public void release() {
107
	init();
112
        init();
108
    }
113
    }
109
114
110
    //*********************************************************************
115
    //*********************************************************************
111
    // Support for parameter management
116
    // Support for parameter management
112
117
113
    /** 
118
    /**
114
     * Provides support for aggregating query parameters in URLs.
119
     * Provides support for aggregating query parameters in URLs.
115
     * Specifically, accepts a series of parameters, ensuring that
120
     * Specifically, accepts a series of parameters, ensuring that
116
     *  - newer parameters will precede older ones in the output URL
121
     * - newer parameters will precede older ones in the output URL
117
     *  - all supplied parameters precede those in the input URL
122
     * - all supplied parameters precede those in the input URL
118
     */
123
     */
119
    public static class ParamManager {
124
    public static class ParamManager {
120
125
121
        //*********************************
126
        //*********************************
122
        // Private state
127
        // Private state
123
128
124
	private List names = new LinkedList();
129
        private List names = new LinkedList();
125
        private List values = new LinkedList();
130
        private List values = new LinkedList();
126
	private boolean done = false;
131
        private boolean done = false;
127
        
132
128
	//*********************************
133
        //*********************************
129
        // Public interface
134
        // Public interface
130
135
131
	/** Adds a new parameter to the list. */
136
        /**
137
         * Adds a new parameter to the list.
138
         */
132
        public void addParameter(String name, String value) {
139
        public void addParameter(String name, String value) {
133
	    if (done)
140
            if (done) {
134
		throw new IllegalStateException();
141
                throw new IllegalStateException();
135
	    if (name != null) {
142
            }
136
	        names.add(name);
143
            if (name != null) {
137
	        if (value != null)
144
                names.add(name);
138
		    values.add(value);
145
                if (value != null) {
139
	        else
146
                    values.add(value);
140
		    values.add("");
147
                } else {
141
	    }
148
                    values.add("");
142
	}
149
                }
150
            }
151
        }
143
152
144
	/**
153
        /**
145
         * Produces a new URL with the stored parameters, in the appropriate
154
         * Produces a new URL with the stored parameters, in the appropriate
146
         * order.
155
         * order.
147
         */
156
         */
148
	public String aggregateParams(String url) {
157
        public String aggregateParams(String url) {
149
	    /* 
158
            /*
150
             * Since for efficiency we're destructive to the param lists,
159
            * Since for efficiency we're destructive to the param lists,
151
             * we don't want to run multiple times.
160
            * we don't want to run multiple times.
152
             */
161
            */
153
	    if (done)
162
            if (done) {
154
		throw new IllegalStateException();
163
                throw new IllegalStateException();
155
	    done = true;
164
            }
165
            done = true;
156
166
157
	    //// reverse the order of our two lists
167
            //// reverse the order of our two lists
158
	    // Collections.reverse(this.names);
168
            // Collections.reverse(this.names);
159
	    // Collections.reverse(this.values);
169
            // Collections.reverse(this.values);
160
170
161
	    // build a string from the parameter list 
171
            // build a string from the parameter list
162
	    StringBuffer newParams = new StringBuffer();
172
            StringBuffer newParams = new StringBuffer();
163
	    for (int i = 0; i < names.size(); i++) {
173
            for (int i = 0; i < names.size(); i++) {
164
		newParams.append(names.get(i) + "=" + values.get(i));
174
                newParams.append(names.get(i) + "=" + values.get(i));
165
		if (i < (names.size() - 1))
175
                if (i < (names.size() - 1)) {
166
		    newParams.append("&");
176
                    newParams.append("&");
167
	    }
177
                }
178
            }
168
179
169
	    // insert these parameters into the URL as appropriate
180
            // insert these parameters into the URL as appropriate
170
	    if (newParams.length() > 0) {
181
            if (newParams.length() > 0) {
171
	        int questionMark = url.indexOf('?');
182
                int questionMark = url.indexOf('?');
172
	        if (questionMark == -1) {
183
                if (questionMark == -1) {
173
		    return (url + "?" + newParams);
184
                    return (url + "?" + newParams);
174
	        } else {
185
                } else {
175
		    StringBuffer workingUrl = new StringBuffer(url);
186
                    StringBuffer workingUrl = new StringBuffer(url);
176
		    workingUrl.insert(questionMark + 1, (newParams + "&"));
187
                    workingUrl.insert(questionMark + 1, (newParams + "&"));
177
		    return workingUrl.toString();
188
                    return workingUrl.toString();
178
	        }
189
                }
179
	    } else {
190
            } else {
180
		return url;
191
                return url;
181
	    }
192
            }
182
	}
193
        }
183
    }
194
    }
184
}
195
}
(-)src/main/java/org/apache/taglibs/standard/tag/common/core/RedirectSupport.java (-26 / +31 lines)
Lines 13-19 Link Here
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
15
 * limitations under the License.
16
 */ 
16
 */
17
17
18
package org.apache.taglibs.standard.tag.common.core;
18
package org.apache.taglibs.standard.tag.common.core;
19
19
Lines 31-37 Link Here
31
 */
31
 */
32
32
33
public abstract class RedirectSupport extends BodyTagSupport
33
public abstract class RedirectSupport extends BodyTagSupport
34
    implements ParamParent {
34
        implements ParamParent {
35
35
36
    //*********************************************************************
36
    //*********************************************************************
37
    // Protected state
37
    // Protected state
Lines 43-67 Link Here
43
    // Private state
43
    // Private state
44
44
45
    private String var;                          // 'var' attribute
45
    private String var;                          // 'var' attribute
46
    private int scope;				 // processed 'scope' attr
46
    private int scope;                 // processed 'scope' attr
47
    private ParamSupport.ParamManager params;	 // added parameters
47
    private ParamSupport.ParamManager params;     // added parameters
48
48
49
    //*********************************************************************
49
    //*********************************************************************
50
    // Constructor and initialization
50
    // Constructor and initialization
51
51
52
    public RedirectSupport() {
52
    public RedirectSupport() {
53
	super();
53
        super();
54
	init();
54
        init();
55
    }
55
    }
56
56
57
    private void init() {
57
    private void init() {
58
	url = var = null;
58
        url = var = null;
59
	params = null;
59
        params = null;
60
	scope = PageContext.PAGE_SCOPE;
60
        scope = PageContext.PAGE_SCOPE;
61
    }
61
    }
62
62
63
63
64
   //*********************************************************************
64
    //*********************************************************************
65
    // Tag attributes known at translation time
65
    // Tag attributes known at translation time
66
66
67
    public void setVar(String var) {
67
    public void setVar(String var) {
Lines 69-75 Link Here
69
    }
69
    }
70
70
71
    public void setScope(String scope) {
71
    public void setScope(String scope) {
72
	this.scope = Util.getScope(scope);
72
        this.scope = Util.getScope(scope);
73
    }
73
    }
74
74
75
75
Lines 77-84 Link Here
77
    // Collaboration with subtags
77
    // Collaboration with subtags
78
78
79
    // inherit Javadoc
79
    // inherit Javadoc
80
80
    public void addParameter(String name, String value) {
81
    public void addParameter(String name, String value) {
81
	params.addParameter(name, value);
82
        params.addParameter(name, value);
82
    }
83
    }
83
84
84
85
Lines 86-126 Link Here
86
    // Tag logic
87
    // Tag logic
87
88
88
    // resets any parameters that might be sent
89
    // resets any parameters that might be sent
90
89
    @Override
91
    @Override
90
    public int doStartTag() throws JspException {
92
    public int doStartTag() throws JspException {
91
	params = new ParamSupport.ParamManager();
93
        params = new ParamSupport.ParamManager();
92
	return EVAL_BODY_BUFFERED;
94
        return EVAL_BODY_BUFFERED;
93
    }
95
    }
94
96
95
97
96
    // gets the right value, encodes it, and prints or stores it
98
    // gets the right value, encodes it, and prints or stores it
99
97
    @Override
100
    @Override
98
    public int doEndTag() throws JspException {
101
    public int doEndTag() throws JspException {
99
	String result;				// the eventual result
102
        String result;                // the eventual result
100
103
101
	// add (already encoded) parameters
104
        // add (already encoded) parameters
102
        String baseUrl = UrlSupport.resolveUrl(url, context, pageContext);
105
        String baseUrl = UrlSupport.resolveUrl(url, context, pageContext);
103
        result = params.aggregateParams(baseUrl);
106
        result = params.aggregateParams(baseUrl);
104
107
105
        // if the URL is relative, rewrite it with 'redirect' encoding rules
108
        // if the URL is relative, rewrite it with 'redirect' encoding rules
106
        HttpServletResponse response =
109
        HttpServletResponse response =
107
            ((HttpServletResponse) pageContext.getResponse());
110
                ((HttpServletResponse) pageContext.getResponse());
108
        if (!ImportSupport.isAbsoluteUrl(result))
111
        if (!ImportSupport.isAbsoluteUrl(result)) {
109
            result = response.encodeRedirectURL(result);
112
            result = response.encodeRedirectURL(result);
113
        }
110
114
111
	// redirect!
115
        // redirect!
112
	try {
116
        try {
113
	    response.sendRedirect(result);
117
            response.sendRedirect(result);
114
	} catch (java.io.IOException ex) {
118
        } catch (java.io.IOException ex) {
115
	    throw new JspTagException(ex.toString(), ex);
119
            throw new JspTagException(ex.toString(), ex);
116
	}
120
        }
117
121
118
	return SKIP_PAGE;
122
        return SKIP_PAGE;
119
    }
123
    }
120
124
121
    // Releases any resources we may have (or inherit)
125
    // Releases any resources we may have (or inherit)
126
122
    @Override
127
    @Override
123
    public void release() {
128
    public void release() {
124
	init();
129
        init();
125
    }
130
    }
126
}
131
}
(-)src/main/java/org/apache/taglibs/standard/util/EscapeXML.java (-18 / +22 lines)
Lines 16-31 Link Here
16
 */
16
 */
17
package org.apache.taglibs.standard.util;
17
package org.apache.taglibs.standard.util;
18
18
19
import javax.servlet.jsp.JspWriter;
20
import java.io.IOException;
19
import java.io.IOException;
21
import java.io.Reader;
20
import java.io.Reader;
22
21
22
import javax.servlet.jsp.JspWriter;
23
23
/**
24
/**
24
 * Handles escaping of characters that could be interpreted as XML markup.
25
 * Handles escaping of characters that could be interpreted as XML markup.
25
 *
26
 * <p/>
26
 * The specification for <code>&lt;c:out&gt;</code> defines the following
27
 * The specification for <code>&lt;c:out&gt;</code> defines the following
27
 * character conversions to be applied:
28
 * character conversions to be applied:
28
 *
29
 * <p/>
29
 * <table rules="all" frame="border">
30
 * <table rules="all" frame="border">
30
 * <thead align="center">
31
 * <thead align="center">
31
 * <tr><th>Character</th><th>Character Entity Code</th></tr>
32
 * <tr><th>Character</th><th>Character Entity Code</th></tr>
Lines 42-47 Link Here
42
public class EscapeXML {
43
public class EscapeXML {
43
44
44
    private static final String[] ESCAPES;
45
    private static final String[] ESCAPES;
46
45
    static {
47
    static {
46
        int size = '>' + 1; // '>' is the largest escaped value
48
        int size = '>' + 1; // '>' is the largest escaped value
47
        ESCAPES = new String[size];
49
        ESCAPES = new String[size];
Lines 100-108 Link Here
100
102
101
    /**
103
    /**
102
     * Emit the supplied object to the specified writer, escaping characters if needed.
104
     * Emit the supplied object to the specified writer, escaping characters if needed.
103
     * @param src the object to write
105
     *
106
     * @param src       the object to write
104
     * @param escapeXml if true, escape unsafe characters before writing
107
     * @param escapeXml if true, escape unsafe characters before writing
105
     * @param out the JspWriter to emit to
108
     * @param out       the JspWriter to emit to
106
     * @throws IOException if there was a problem emitting the content
109
     * @throws IOException if there was a problem emitting the content
107
     */
110
     */
108
    public static void emit(Object src, boolean escapeXml, JspWriter out) throws IOException {
111
    public static void emit(Object src, boolean escapeXml, JspWriter out) throws IOException {
Lines 115-123 Link Here
115
118
116
    /**
119
    /**
117
     * Emit the supplied String to the specified writer, escaping characters if needed.
120
     * Emit the supplied String to the specified writer, escaping characters if needed.
118
     * @param src the String to write
121
     *
122
     * @param src       the String to write
119
     * @param escapeXml if true, escape unsafe characters before writing
123
     * @param escapeXml if true, escape unsafe characters before writing
120
     * @param out the JspWriter to emit to
124
     * @param out       the JspWriter to emit to
121
     * @throws IOException if there was a problem emitting the content
125
     * @throws IOException if there was a problem emitting the content
122
     */
126
     */
123
    public static void emit(String src, boolean escapeXml, JspWriter out) throws IOException {
127
    public static void emit(String src, boolean escapeXml, JspWriter out) throws IOException {
Lines 138-164 Link Here
138
    public static void emit(String src, JspWriter out) throws IOException {
142
    public static void emit(String src, JspWriter out) throws IOException {
139
        int end = src.length();
143
        int end = src.length();
140
        int from = 0;
144
        int from = 0;
141
        for (int to = from ; to < end; to++) {
145
        for (int to = from; to < end; to++) {
142
            String escape = getEscape(src.charAt(to));
146
            String escape = getEscape(src.charAt(to));
143
            if (escape != null) {
147
            if (escape != null) {
144
                if (to != from) {
148
                if (to != from) {
145
                    out.write(src, from, to-from);
149
                    out.write(src, from, to - from);
146
                }
150
                }
147
                out.write(escape);
151
                out.write(escape);
148
                from = to + 1;
152
                from = to + 1;
149
            }
153
            }
150
        }
154
        }
151
        if (from != end) {
155
        if (from != end) {
152
            out.write(src, from, end-from);
156
            out.write(src, from, end - from);
153
        }
157
        }
154
    }
158
    }
155
159
156
    /**
160
    /**
157
     * Copy the content of a Reader into the specified JSPWriter escaping characters if needed.
161
     * Copy the content of a Reader into the specified JSPWriter escaping characters if needed.
158
     *
162
     *
159
     * @param src the Reader to read from
163
     * @param src       the Reader to read from
160
     * @param escapeXml if true, escape characters
164
     * @param escapeXml if true, escape characters
161
     * @param out the JspWriter to emit to
165
     * @param out       the JspWriter to emit to
162
     * @throws IOException if there was a problem emitting the content
166
     * @throws IOException if there was a problem emitting the content
163
     */
167
     */
164
    public static void emit(Reader src, boolean escapeXml, JspWriter out) throws IOException {
168
    public static void emit(Reader src, boolean escapeXml, JspWriter out) throws IOException {
Lines 181-205 Link Here
181
     * Emit escaped content into the specified JSPWriter.
185
     * Emit escaped content into the specified JSPWriter.
182
     *
186
     *
183
     * @param buffer characters to escape
187
     * @param buffer characters to escape
184
     * @param from start position in the buffer
188
     * @param from   start position in the buffer
185
     * @param count number of characters to emit
189
     * @param count  number of characters to emit
186
     * @param out the JspWriter to emit to
190
     * @param out    the JspWriter to emit to
187
     * @throws IOException if there was a problem emitting the content
191
     * @throws IOException if there was a problem emitting the content
188
     */
192
     */
189
    public static void emit(char[] buffer, int from, int count, JspWriter out) throws IOException {
193
    public static void emit(char[] buffer, int from, int count, JspWriter out) throws IOException {
190
        int end = from + count;
194
        int end = from + count;
191
        for (int to = from ; to < end; to++) {
195
        for (int to = from; to < end; to++) {
192
            String escape = getEscape(buffer[to]);
196
            String escape = getEscape(buffer[to]);
193
            if (escape != null) {
197
            if (escape != null) {
194
                if (to != from) {
198
                if (to != from) {
195
                    out.write(buffer, from, to-from);
199
                    out.write(buffer, from, to - from);
196
                }
200
                }
197
                out.write(escape);
201
                out.write(escape);
198
                from = to + 1;
202
                from = to + 1;
199
            }
203
            }
200
        }
204
        }
201
        if (from != end) {
205
        if (from != end) {
202
            out.write(buffer, from, end-from);
206
            out.write(buffer, from, end - from);
203
        }
207
        }
204
    }
208
    }
205
}
209
}
(-)src/main/java/org/apache/taglibs/standard/util/ExpressionUtil.java (-2 / +2 lines)
Lines 30-37 Link Here
30
    /**
30
    /**
31
     * Create a value expression.
31
     * Create a value expression.
32
     *
32
     *
33
     * @param pageContext the context in which the expression will be parsed
33
     * @param pageContext  the context in which the expression will be parsed
34
     * @param expression the expression
34
     * @param expression   the expression
35
     * @param expectedType the expected type of result
35
     * @param expectedType the expected type of result
36
     * @return a parsed expression
36
     * @return a parsed expression
37
     */
37
     */
(-)src/main/resources/META-INF/sql-1_0-rt.tld (-177 / +177 lines)
Lines 1-188 Link Here
1
<?xml version="1.0" encoding="ISO-8859-1" ?>
1
<?xml version="1.0" encoding="ISO-8859-1" ?>
2
<!DOCTYPE taglib
2
<!DOCTYPE taglib
3
  PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
3
        PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
4
  "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
4
        "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
5
<taglib>
5
<taglib>
6
  <tlib-version>1.0</tlib-version>
6
    <tlib-version>1.0</tlib-version>
7
  <jsp-version>1.2</jsp-version>
7
    <jsp-version>1.2</jsp-version>
8
  <short-name>sql_rt</short-name>
8
    <short-name>sql_rt</short-name>
9
  <uri>http://java.sun.com/jstl/sql_rt</uri>
9
    <uri>http://java.sun.com/jstl/sql_rt</uri>
10
  <display-name>JSTL sql RT</display-name>
10
    <display-name>JSTL sql RT</display-name>
11
  <description>JSTL 1.0 sql library</description>
11
    <description>JSTL 1.0 sql library</description>
12
12
13
  <validator>
13
    <validator>
14
    <validator-class>
14
        <validator-class>
15
        org.apache.taglibs.standard.tlv.JstlSqlTLV
15
            org.apache.taglibs.standard.tlv.JstlSqlTLV
16
    </validator-class>
16
        </validator-class>
17
    <description>
17
        <description>
18
        Provides core validation features for JSTL tags.
18
            Provides core validation features for JSTL tags.
19
    </description>
19
        </description>
20
  </validator>
20
    </validator>
21
21
22
  <tag>
22
    <tag>
23
    <name>transaction</name>
23
        <name>transaction</name>
24
    <tag-class>org.apache.taglibs.standard.tag.rt.sql.TransactionTag</tag-class>
24
        <tag-class>org.apache.taglibs.standard.tag.rt.sql.TransactionTag</tag-class>
25
    <body-content>JSP</body-content>
25
        <body-content>JSP</body-content>
26
    <description>
26
        <description>
27
        Provides nested database action elements with a shared Connection,
27
            Provides nested database action elements with a shared Connection,
28
        set up to execute all statements as one transaction.
28
            set up to execute all statements as one transaction.
29
    </description>
29
        </description>
30
    <attribute>
30
        <attribute>
31
        <name>dataSource</name>
31
            <name>dataSource</name>
32
        <required>false</required>
32
            <required>false</required>
33
        <rtexprvalue>true</rtexprvalue>
33
            <rtexprvalue>true</rtexprvalue>
34
    </attribute>
34
        </attribute>
35
    <attribute>
35
        <attribute>
36
        <name>isolation</name>
36
            <name>isolation</name>
37
        <required>false</required>
37
            <required>false</required>
38
        <rtexprvalue>true</rtexprvalue>
38
            <rtexprvalue>true</rtexprvalue>
39
    </attribute>
39
        </attribute>
40
  </tag>
40
    </tag>
41
41
42
  <tag>
42
    <tag>
43
    <name>query</name>
43
        <name>query</name>
44
    <tag-class>org.apache.taglibs.standard.tag.rt.sql.QueryTag</tag-class>
44
        <tag-class>org.apache.taglibs.standard.tag.rt.sql.QueryTag</tag-class>
45
    <body-content>JSP</body-content>
45
        <body-content>JSP</body-content>
46
    <description>
46
        <description>
47
        Executes the SQL query defined in its body or through the
47
            Executes the SQL query defined in its body or through the
48
        sql attribute.
48
            sql attribute.
49
    </description>
49
        </description>
50
    <attribute>
50
        <attribute>
51
        <name>var</name>
51
            <name>var</name>
52
        <required>true</required>
52
            <required>true</required>
53
        <rtexprvalue>false</rtexprvalue>
53
            <rtexprvalue>false</rtexprvalue>
54
    </attribute>
54
        </attribute>
55
    <attribute>
55
        <attribute>
56
        <name>scope</name>
56
            <name>scope</name>
57
        <required>false</required>
57
            <required>false</required>
58
        <rtexprvalue>false</rtexprvalue>
58
            <rtexprvalue>false</rtexprvalue>
59
    </attribute>
59
        </attribute>
60
    <attribute>
60
        <attribute>
61
        <name>sql</name>
61
            <name>sql</name>
62
        <required>false</required>
62
            <required>false</required>
63
        <rtexprvalue>true</rtexprvalue>
63
            <rtexprvalue>true</rtexprvalue>
64
    </attribute>
64
        </attribute>
65
    <attribute>
65
        <attribute>
66
        <name>dataSource</name>
66
            <name>dataSource</name>
67
        <required>false</required>
67
            <required>false</required>
68
        <rtexprvalue>true</rtexprvalue>
68
            <rtexprvalue>true</rtexprvalue>
69
    </attribute>
69
        </attribute>
70
    <attribute>
70
        <attribute>
71
        <name>startRow</name>
71
            <name>startRow</name>
72
        <required>false</required>
72
            <required>false</required>
73
        <rtexprvalue>true</rtexprvalue>
73
            <rtexprvalue>true</rtexprvalue>
74
    </attribute>
74
        </attribute>
75
    <attribute>
75
        <attribute>
76
        <name>maxRows</name>
76
            <name>maxRows</name>
77
        <required>false</required>
77
            <required>false</required>
78
        <rtexprvalue>true</rtexprvalue>
78
            <rtexprvalue>true</rtexprvalue>
79
    </attribute>
79
        </attribute>
80
  </tag>
80
    </tag>
81
81
82
  <tag>
82
    <tag>
83
    <name>update</name>
83
        <name>update</name>
84
    <tag-class>org.apache.taglibs.standard.tag.rt.sql.UpdateTag</tag-class>
84
        <tag-class>org.apache.taglibs.standard.tag.rt.sql.UpdateTag</tag-class>
85
    <body-content>JSP</body-content>
85
        <body-content>JSP</body-content>
86
    <description>
86
        <description>
87
        Executes the SQL update defined in its body or through the
87
            Executes the SQL update defined in its body or through the
88
        sql attribute.
88
            sql attribute.
89
    </description>
89
        </description>
90
    <attribute>
90
        <attribute>
91
        <name>var</name>
91
            <name>var</name>
92
        <required>false</required>
92
            <required>false</required>
93
        <rtexprvalue>false</rtexprvalue>
93
            <rtexprvalue>false</rtexprvalue>
94
    </attribute>
94
        </attribute>
95
    <attribute>
95
        <attribute>
96
        <name>scope</name>
96
            <name>scope</name>
97
        <required>false</required>
97
            <required>false</required>
98
        <rtexprvalue>false</rtexprvalue>
98
            <rtexprvalue>false</rtexprvalue>
99
    </attribute>
99
        </attribute>
100
    <attribute>
100
        <attribute>
101
        <name>sql</name>
101
            <name>sql</name>
102
        <required>false</required>
102
            <required>false</required>
103
        <rtexprvalue>true</rtexprvalue>
103
            <rtexprvalue>true</rtexprvalue>
104
    </attribute>
104
        </attribute>
105
    <attribute>
105
        <attribute>
106
        <name>dataSource</name>
106
            <name>dataSource</name>
107
        <required>false</required>
107
            <required>false</required>
108
        <rtexprvalue>true</rtexprvalue>
108
            <rtexprvalue>true</rtexprvalue>
109
    </attribute>
109
        </attribute>
110
  </tag>
110
    </tag>
111
111
112
  <tag>
112
    <tag>
113
    <name>param</name>
113
        <name>param</name>
114
    <tag-class>org.apache.taglibs.standard.tag.rt.sql.ParamTag</tag-class>
114
        <tag-class>org.apache.taglibs.standard.tag.rt.sql.ParamTag</tag-class>
115
    <body-content>JSP</body-content>
115
        <body-content>JSP</body-content>
116
    <description>
116
        <description>
117
        Sets a parameter in an SQL statement to the specified value.
117
            Sets a parameter in an SQL statement to the specified value.
118
    </description>
118
        </description>
119
    <attribute>
119
        <attribute>
120
        <name>value</name>
120
            <name>value</name>
121
        <required>false</required>
121
            <required>false</required>
122
        <rtexprvalue>true</rtexprvalue>
122
            <rtexprvalue>true</rtexprvalue>
123
    </attribute>
123
        </attribute>
124
  </tag>
124
    </tag>
125
125
126
  <tag>
126
    <tag>
127
    <name>dateParam</name>
127
        <name>dateParam</name>
128
    <tag-class>org.apache.taglibs.standard.tag.rt.sql.DateParamTag</tag-class>
128
        <tag-class>org.apache.taglibs.standard.tag.rt.sql.DateParamTag</tag-class>
129
    <body-content>empty</body-content>
129
        <body-content>empty</body-content>
130
    <description>
130
        <description>
131
        Sets a parameter in an SQL statement to the specified java.util.Date value.
131
            Sets a parameter in an SQL statement to the specified java.util.Date value.
132
    </description>
132
        </description>
133
    <attribute>
133
        <attribute>
134
        <name>value</name>
134
            <name>value</name>
135
        <required>true</required>
135
            <required>true</required>
136
        <rtexprvalue>true</rtexprvalue>
136
            <rtexprvalue>true</rtexprvalue>
137
    </attribute>
137
        </attribute>
138
    <attribute>
138
        <attribute>
139
        <name>type</name>
139
            <name>type</name>
140
        <required>false</required>
140
            <required>false</required>
141
        <rtexprvalue>true</rtexprvalue>
141
            <rtexprvalue>true</rtexprvalue>
142
    </attribute>
142
        </attribute>
143
  </tag>
143
    </tag>
144
144
145
  <tag>
145
    <tag>
146
    <name>setDataSource</name>
146
        <name>setDataSource</name>
147
    <tag-class>org.apache.taglibs.standard.tag.rt.sql.SetDataSourceTag</tag-class>
147
        <tag-class>org.apache.taglibs.standard.tag.rt.sql.SetDataSourceTag</tag-class>
148
    <body-content>empty</body-content>
148
        <body-content>empty</body-content>
149
    <description>
149
        <description>
150
        Creates a simple DataSource suitable only for prototyping.
150
            Creates a simple DataSource suitable only for prototyping.
151
    </description>
151
        </description>
152
    <attribute>
152
        <attribute>
153
        <name>var</name>
153
            <name>var</name>
154
        <required>false</required>
154
            <required>false</required>
155
        <rtexprvalue>false</rtexprvalue>
155
            <rtexprvalue>false</rtexprvalue>
156
    </attribute>
156
        </attribute>
157
    <attribute>
157
        <attribute>
158
        <name>scope</name>
158
            <name>scope</name>
159
        <required>false</required>
159
            <required>false</required>
160
        <rtexprvalue>false</rtexprvalue>
160
            <rtexprvalue>false</rtexprvalue>
161
    </attribute>
161
        </attribute>
162
    <attribute>
162
        <attribute>
163
        <name>dataSource</name>
163
            <name>dataSource</name>
164
        <required>false</required>
164
            <required>false</required>
165
        <rtexprvalue>true</rtexprvalue>
165
            <rtexprvalue>true</rtexprvalue>
166
    </attribute>
166
        </attribute>
167
    <attribute>
167
        <attribute>
168
        <name>driver</name>
168
            <name>driver</name>
169
        <required>false</required>
169
            <required>false</required>
170
        <rtexprvalue>true</rtexprvalue>
170
            <rtexprvalue>true</rtexprvalue>
171
    </attribute>
171
        </attribute>
172
    <attribute>
172
        <attribute>
173
        <name>url</name>
173
            <name>url</name>
174
        <required>false</required>
174
            <required>false</required>
175
        <rtexprvalue>true</rtexprvalue>
175
            <rtexprvalue>true</rtexprvalue>
176
    </attribute>
176
        </attribute>
177
    <attribute>
177
        <attribute>
178
        <name>user</name>
178
            <name>user</name>
179
        <required>false</required>
179
            <required>false</required>
180
        <rtexprvalue>true</rtexprvalue>
180
            <rtexprvalue>true</rtexprvalue>
181
    </attribute>
181
        </attribute>
182
    <attribute>
182
        <attribute>
183
        <name>password</name>
183
            <name>password</name>
184
        <required>false</required>
184
            <required>false</required>
185
        <rtexprvalue>true</rtexprvalue>
185
            <rtexprvalue>true</rtexprvalue>
186
    </attribute>
186
        </attribute>
187
  </tag>
187
    </tag>
188
</taglib>
188
</taglib>
(-)src/main/resources/META-INF/sql.tld (-264 / +264 lines)
Lines 1-289 Link Here
1
<?xml version="1.0" encoding="UTF-8" ?>
1
<?xml version="1.0" encoding="UTF-8" ?>
2
2
3
<taglib xmlns="http://java.sun.com/xml/ns/j2ee"
3
<taglib xmlns="http://java.sun.com/xml/ns/j2ee"
4
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
5
        xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
6
    version="2.0">
6
        version="2.0">
7
    
8
  <description>JSTL 1.1 sql library</description>
9
  <display-name>JSTL sql</display-name>
10
  <tlib-version>1.1</tlib-version>
11
  <short-name>sql</short-name>
12
  <uri>http://java.sun.com/jsp/jstl/sql</uri>
13
7
14
  <validator>
8
    <description>JSTL 1.1 sql library</description>
15
    <description>
9
    <display-name>JSTL sql</display-name>
16
        Provides core validation features for JSTL tags.
10
    <tlib-version>1.1</tlib-version>
17
    </description>
11
    <short-name>sql</short-name>
18
    <validator-class>
12
    <uri>http://java.sun.com/jsp/jstl/sql</uri>
19
        org.apache.taglibs.standard.tlv.JstlSqlTLV
20
    </validator-class>
21
  </validator>
22
13
23
  <tag>
14
    <validator>
24
    <description>
25
        Provides nested database action elements with a shared Connection,
26
        set up to execute all statements as one transaction.
27
    </description>
28
    <name>transaction</name>
29
    <tag-class>org.apache.taglibs.standard.tag.rt.sql.TransactionTag</tag-class>
30
    <body-content>JSP</body-content>
31
    <attribute>
32
        <description>
15
        <description>
33
DataSource associated with the database to access. A
16
            Provides core validation features for JSTL tags.
34
String value represents a relative path to a JNDI
35
resource or the parameters for the JDBC
36
DriverManager facility.
37
        </description>
17
        </description>
38
        <name>dataSource</name>
18
        <validator-class>
39
        <required>false</required>
19
            org.apache.taglibs.standard.tlv.JstlSqlTLV
40
        <rtexprvalue>true</rtexprvalue>
20
        </validator-class>
41
    </attribute>
21
    </validator>
42
    <attribute>
22
23
    <tag>
43
        <description>
24
        <description>
44
Transaction isolation level. If not specified, it is the
25
            Provides nested database action elements with a shared Connection,
45
isolation level the DataSource has been configured
26
            set up to execute all statements as one transaction.
46
with.
47
        </description>
27
        </description>
48
        <name>isolation</name>
28
        <name>transaction</name>
49
        <required>false</required>
29
        <tag-class>org.apache.taglibs.standard.tag.rt.sql.TransactionTag</tag-class>
50
        <rtexprvalue>true</rtexprvalue>
30
        <body-content>JSP</body-content>
51
    </attribute>
31
        <attribute>
52
  </tag>
32
            <description>
33
                DataSource associated with the database to access. A
34
                String value represents a relative path to a JNDI
35
                resource or the parameters for the JDBC
36
                DriverManager facility.
37
            </description>
38
            <name>dataSource</name>
39
            <required>false</required>
40
            <rtexprvalue>true</rtexprvalue>
41
        </attribute>
42
        <attribute>
43
            <description>
44
                Transaction isolation level. If not specified, it is the
45
                isolation level the DataSource has been configured
46
                with.
47
            </description>
48
            <name>isolation</name>
49
            <required>false</required>
50
            <rtexprvalue>true</rtexprvalue>
51
        </attribute>
52
    </tag>
53
53
54
  <tag>
54
    <tag>
55
    <description>
56
        Executes the SQL query defined in its body or through the
57
        sql attribute.
58
    </description>
59
    <name>query</name>
60
    <tag-class>org.apache.taglibs.standard.tag.rt.sql.QueryTag</tag-class>
61
    <body-content>JSP</body-content>
62
    <attribute>
63
        <description>
55
        <description>
64
Name of the exported scoped variable for the
56
            Executes the SQL query defined in its body or through the
65
query result. The type of the scoped variable is
57
            sql attribute.
66
javax.servlet.jsp.jstl.sql.
67
Result (see Chapter 16 "Java APIs").
68
        </description>
58
        </description>
69
        <name>var</name>
59
        <name>query</name>
70
        <required>true</required>
60
        <tag-class>org.apache.taglibs.standard.tag.rt.sql.QueryTag</tag-class>
71
        <rtexprvalue>false</rtexprvalue>
61
        <body-content>JSP</body-content>
72
    </attribute>
62
        <attribute>
73
    <attribute>
63
            <description>
74
        <description>
64
                Name of the exported scoped variable for the
75
Scope of var.
65
                query result. The type of the scoped variable is
76
        </description>
66
                javax.servlet.jsp.jstl.sql.
77
        <name>scope</name>
67
                Result (see Chapter 16 "Java APIs").
78
        <required>false</required>
68
            </description>
79
        <rtexprvalue>false</rtexprvalue>
69
            <name>var</name>
80
    </attribute>
70
            <required>true</required>
81
    <attribute>
71
            <rtexprvalue>false</rtexprvalue>
82
        <description>
72
        </attribute>
83
SQL query statement.
73
        <attribute>
84
        </description>
74
            <description>
85
        <name>sql</name>
75
                Scope of var.
86
        <required>false</required>
76
            </description>
87
        <rtexprvalue>true</rtexprvalue>
77
            <name>scope</name>
88
    </attribute>
78
            <required>false</required>
89
    <attribute>
79
            <rtexprvalue>false</rtexprvalue>
90
        <description>
80
        </attribute>
91
Data source associated with the database to
81
        <attribute>
92
query. A String value represents a relative path
82
            <description>
93
to a JNDI resource or the parameters for the
83
                SQL query statement.
94
DriverManager class.
84
            </description>
95
        </description>
85
            <name>sql</name>
96
        <name>dataSource</name>
86
            <required>false</required>
97
        <required>false</required>
87
            <rtexprvalue>true</rtexprvalue>
98
        <rtexprvalue>true</rtexprvalue>
88
        </attribute>
99
    </attribute>
89
        <attribute>
100
    <attribute>
90
            <description>
101
        <description>
91
                Data source associated with the database to
102
The returned Result object includes the rows
92
                query. A String value represents a relative path
103
starting at the specified index. The first row of
93
                to a JNDI resource or the parameters for the
104
the original query result set is at index 0. If not
94
                DriverManager class.
105
specified, rows are included starting from the
95
            </description>
106
first row at index 0.
96
            <name>dataSource</name>
107
        </description>
97
            <required>false</required>
108
        <name>startRow</name>
98
            <rtexprvalue>true</rtexprvalue>
109
        <required>false</required>
99
        </attribute>
110
        <rtexprvalue>true</rtexprvalue>
100
        <attribute>
111
    </attribute>
101
            <description>
112
    <attribute>
102
                The returned Result object includes the rows
113
        <description>
103
                starting at the specified index. The first row of
114
The maximum number of rows to be included in
104
                the original query result set is at index 0. If not
115
the query result. If not specified, or set to -1, no
105
                specified, rows are included starting from the
116
limit on the maximum number of rows is
106
                first row at index 0.
117
enforced.
107
            </description>
118
        </description>
108
            <name>startRow</name>
119
        <name>maxRows</name>
109
            <required>false</required>
120
        <required>false</required>
110
            <rtexprvalue>true</rtexprvalue>
121
        <rtexprvalue>true</rtexprvalue>
111
        </attribute>
122
    </attribute>
112
        <attribute>
123
  </tag>
113
            <description>
114
                The maximum number of rows to be included in
115
                the query result. If not specified, or set to -1, no
116
                limit on the maximum number of rows is
117
                enforced.
118
            </description>
119
            <name>maxRows</name>
120
            <required>false</required>
121
            <rtexprvalue>true</rtexprvalue>
122
        </attribute>
123
    </tag>
124
124
125
  <tag>
125
    <tag>
126
    <description>
127
        Executes the SQL update defined in its body or through the
128
        sql attribute.
129
    </description>
130
    <name>update</name>
131
    <tag-class>org.apache.taglibs.standard.tag.rt.sql.UpdateTag</tag-class>
132
    <body-content>JSP</body-content>
133
    <attribute>
134
        <description>
126
        <description>
135
Name of the exported scoped variable for the result
127
            Executes the SQL update defined in its body or through the
136
of the database update. The type of the scoped
128
            sql attribute.
137
variable is java.lang.Integer.
138
        </description>
129
        </description>
139
        <name>var</name>
130
        <name>update</name>
140
        <required>false</required>
131
        <tag-class>org.apache.taglibs.standard.tag.rt.sql.UpdateTag</tag-class>
141
        <rtexprvalue>false</rtexprvalue>
132
        <body-content>JSP</body-content>
142
    </attribute>
133
        <attribute>
143
    <attribute>
134
            <description>
144
        <description>
135
                Name of the exported scoped variable for the result
145
Scope of var.
136
                of the database update. The type of the scoped
146
        </description>
137
                variable is java.lang.Integer.
147
        <name>scope</name>
138
            </description>
148
        <required>false</required>
139
            <name>var</name>
149
        <rtexprvalue>false</rtexprvalue>
140
            <required>false</required>
150
    </attribute>
141
            <rtexprvalue>false</rtexprvalue>
151
    <attribute>
142
        </attribute>
152
        <description>
143
        <attribute>
153
SQL update statement.
144
            <description>
154
        </description>
145
                Scope of var.
155
        <name>sql</name>
146
            </description>
156
        <required>false</required>
147
            <name>scope</name>
157
        <rtexprvalue>true</rtexprvalue>
148
            <required>false</required>
158
    </attribute>
149
            <rtexprvalue>false</rtexprvalue>
159
    <attribute>
150
        </attribute>
160
        <description>
151
        <attribute>
161
Data source associated with the database to update.
152
            <description>
162
A String value represents a relative path to a JNDI
153
                SQL update statement.
163
resource or the parameters for the JDBC
154
            </description>
164
DriverManager class.
155
            <name>sql</name>
165
        </description>
156
            <required>false</required>
166
        <name>dataSource</name>
157
            <rtexprvalue>true</rtexprvalue>
167
        <required>false</required>
158
        </attribute>
168
        <rtexprvalue>true</rtexprvalue>
159
        <attribute>
169
    </attribute>
160
            <description>
170
  </tag>
161
                Data source associated with the database to update.
162
                A String value represents a relative path to a JNDI
163
                resource or the parameters for the JDBC
164
                DriverManager class.
165
            </description>
166
            <name>dataSource</name>
167
            <required>false</required>
168
            <rtexprvalue>true</rtexprvalue>
169
        </attribute>
170
    </tag>
171
171
172
  <tag>
172
    <tag>
173
    <description>
174
        Sets a parameter in an SQL statement to the specified value.
175
    </description>
176
    <name>param</name>
177
    <tag-class>org.apache.taglibs.standard.tag.rt.sql.ParamTag</tag-class>
178
    <body-content>JSP</body-content>
179
    <attribute>
180
        <description>
173
        <description>
181
Parameter value.
174
            Sets a parameter in an SQL statement to the specified value.
182
        </description>
175
        </description>
183
        <name>value</name>
176
        <name>param</name>
184
        <required>false</required>
177
        <tag-class>org.apache.taglibs.standard.tag.rt.sql.ParamTag</tag-class>
185
        <rtexprvalue>true</rtexprvalue>
178
        <body-content>JSP</body-content>
186
    </attribute>
179
        <attribute>
187
  </tag>
180
            <description>
181
                Parameter value.
182
            </description>
183
            <name>value</name>
184
            <required>false</required>
185
            <rtexprvalue>true</rtexprvalue>
186
        </attribute>
187
    </tag>
188
188
189
  <tag>
189
    <tag>
190
    <description>
191
        Sets a parameter in an SQL statement to the specified java.util.Date value.
192
    </description>
193
    <name>dateParam</name>
194
    <tag-class>org.apache.taglibs.standard.tag.rt.sql.DateParamTag</tag-class>
195
    <body-content>empty</body-content>
196
    <attribute>
197
        <description>
190
        <description>
198
Parameter value for DATE, TIME, or
191
            Sets a parameter in an SQL statement to the specified java.util.Date value.
199
TIMESTAMP column in a database table.
200
        </description>
192
        </description>
201
        <name>value</name>
193
        <name>dateParam</name>
202
        <required>true</required>
194
        <tag-class>org.apache.taglibs.standard.tag.rt.sql.DateParamTag</tag-class>
203
        <rtexprvalue>true</rtexprvalue>
195
        <body-content>empty</body-content>
204
    </attribute>
196
        <attribute>
205
    <attribute>
197
            <description>
206
        <description>
198
                Parameter value for DATE, TIME, or
207
One of "date", "time" or "timestamp".
199
                TIMESTAMP column in a database table.
208
        </description>
200
            </description>
209
        <name>type</name>
201
            <name>value</name>
210
        <required>false</required>
202
            <required>true</required>
211
        <rtexprvalue>true</rtexprvalue>
203
            <rtexprvalue>true</rtexprvalue>
212
    </attribute>
204
        </attribute>
213
  </tag>
205
        <attribute>
206
            <description>
207
                One of "date", "time" or "timestamp".
208
            </description>
209
            <name>type</name>
210
            <required>false</required>
211
            <rtexprvalue>true</rtexprvalue>
212
        </attribute>
213
    </tag>
214
214
215
  <tag>
215
    <tag>
216
    <description>
217
        Creates a simple DataSource suitable only for prototyping.
218
    </description>
219
    <name>setDataSource</name>
220
    <tag-class>org.apache.taglibs.standard.tag.rt.sql.SetDataSourceTag</tag-class>
221
    <body-content>empty</body-content>
222
    <attribute>
223
        <description>
216
        <description>
224
Name of the exported scoped variable
217
            Creates a simple DataSource suitable only for prototyping.
225
for the data source specified. Type can
226
be String or DataSource.
227
        </description>
218
        </description>
228
        <name>var</name>
219
        <name>setDataSource</name>
229
        <required>false</required>
220
        <tag-class>org.apache.taglibs.standard.tag.rt.sql.SetDataSourceTag</tag-class>
230
        <rtexprvalue>false</rtexprvalue>
221
        <body-content>empty</body-content>
231
    </attribute>
222
        <attribute>
232
    <attribute>
223
            <description>
233
        <description>
224
                Name of the exported scoped variable
234
If var is specified, scope of the
225
                for the data source specified. Type can
235
exported variable. Otherwise, scope of
226
                be String or DataSource.
236
the data source configuration variable.
227
            </description>
237
        </description>
228
            <name>var</name>
238
        <name>scope</name>
229
            <required>false</required>
239
        <required>false</required>
230
            <rtexprvalue>false</rtexprvalue>
240
        <rtexprvalue>false</rtexprvalue>
231
        </attribute>
241
    </attribute>
232
        <attribute>
242
    <attribute>
233
            <description>
243
        <description>
234
                If var is specified, scope of the
244
Data source. If specified as a string, it
235
                exported variable. Otherwise, scope of
245
can either be a relative path to a JNDI
236
                the data source configuration variable.
246
resource, or a JDBC parameters string
237
            </description>
247
as defined in Section 10.1.1.
238
            <name>scope</name>
248
        </description>
239
            <required>false</required>
249
        <name>dataSource</name>
240
            <rtexprvalue>false</rtexprvalue>
250
        <required>false</required>
241
        </attribute>
251
        <rtexprvalue>true</rtexprvalue>
242
        <attribute>
252
    </attribute>
243
            <description>
253
    <attribute>
244
                Data source. If specified as a string, it
254
        <description>
245
                can either be a relative path to a JNDI
255
JDBC parameter: driver class name.
246
                resource, or a JDBC parameters string
256
        </description>
247
                as defined in Section 10.1.1.
257
        <name>driver</name>
248
            </description>
258
        <required>false</required>
249
            <name>dataSource</name>
259
        <rtexprvalue>true</rtexprvalue>
250
            <required>false</required>
260
    </attribute>
251
            <rtexprvalue>true</rtexprvalue>
261
    <attribute>
252
        </attribute>
262
        <description>
253
        <attribute>
263
JDBC parameter: URL associated with
254
            <description>
264
the database.
255
                JDBC parameter: driver class name.
265
        </description>
256
            </description>
266
        <name>url</name>
257
            <name>driver</name>
267
        <required>false</required>
258
            <required>false</required>
268
        <rtexprvalue>true</rtexprvalue>
259
            <rtexprvalue>true</rtexprvalue>
269
    </attribute>
260
        </attribute>
270
    <attribute>
261
        <attribute>
271
        <description>
262
            <description>
272
JDBC parameter: database user on
263
                JDBC parameter: URL associated with
273
whose behalf the connection to the
264
                the database.
274
database is being made.
265
            </description>
275
        </description>
266
            <name>url</name>
276
        <name>user</name>
267
            <required>false</required>
277
        <required>false</required>
268
            <rtexprvalue>true</rtexprvalue>
278
        <rtexprvalue>true</rtexprvalue>
269
        </attribute>
279
    </attribute>
270
        <attribute>
280
    <attribute>
271
            <description>
281
        <description>
272
                JDBC parameter: database user on
282
JDBC parameter: user password
273
                whose behalf the connection to the
283
        </description>
274
                database is being made.
284
        <name>password</name>
275
            </description>
285
        <required>false</required>
276
            <name>user</name>
286
        <rtexprvalue>true</rtexprvalue>
277
            <required>false</required>
287
    </attribute>
278
            <rtexprvalue>true</rtexprvalue>
288
  </tag>
279
        </attribute>
280
        <attribute>
281
            <description>
282
                JDBC parameter: user password
283
            </description>
284
            <name>password</name>
285
            <required>false</required>
286
            <rtexprvalue>true</rtexprvalue>
287
        </attribute>
288
    </tag>
289
</taglib>
289
</taglib>
(-)src/main/resources/META-INF/c-1_1.tld (-514 / +514 lines)
Lines 1-563 Link Here
1
<?xml version="1.0" encoding="UTF-8" ?>
1
<?xml version="1.0" encoding="UTF-8" ?>
2
2
3
<taglib xmlns="http://java.sun.com/xml/ns/j2ee"
3
<taglib xmlns="http://java.sun.com/xml/ns/j2ee"
4
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
5
        xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
6
    version="2.0">
6
        version="2.0">
7
    
8
  <description>JSTL 1.1 core library</description>
9
  <display-name>JSTL core</display-name>
10
  <tlib-version>1.1</tlib-version>
11
  <short-name>c</short-name>
12
  <uri>http://java.sun.com/jsp/jstl/core_1_1</uri>
13
7
14
  <validator>
8
    <description>JSTL 1.1 core library</description>
15
    <description>
9
    <display-name>JSTL core</display-name>
16
        Provides core validation features for JSTL tags.
10
    <tlib-version>1.1</tlib-version>
17
    </description>
11
    <short-name>c</short-name>
18
    <validator-class>
12
    <uri>http://java.sun.com/jsp/jstl/core_1_1</uri>
19
        org.apache.taglibs.standard.tlv.JstlCoreTLV
20
    </validator-class>
21
  </validator>
22
13
23
  <tag>
14
    <validator>
24
    <description>
25
        Catches any Throwable that occurs in its body and optionally
26
        exposes it.
27
    </description>
28
    <name>catch</name>
29
    <tag-class>org.apache.taglibs.standard.tag.common.core.CatchTag</tag-class>
30
    <body-content>JSP</body-content>
31
    <attribute>
32
        <description>
15
        <description>
33
Name of the exported scoped variable for the
16
            Provides core validation features for JSTL tags.
34
exception thrown from a nested action. The type of the
35
scoped variable is the type of the exception thrown.
36
        </description>
17
        </description>
37
        <name>var</name>
18
        <validator-class>
38
        <required>false</required>
19
            org.apache.taglibs.standard.tlv.JstlCoreTLV
39
        <rtexprvalue>false</rtexprvalue>
20
        </validator-class>
40
    </attribute>
21
    </validator>
41
  </tag>
42
22
43
  <tag>
23
    <tag>
44
    <description>
45
	Simple conditional tag that establishes a context for
46
	mutually exclusive conditional operations, marked by
47
	&lt;when&gt; and &lt;otherwise&gt;
48
    </description>
49
    <name>choose</name>
50
    <tag-class>org.apache.taglibs.standard.tag.common.core.ChooseTag</tag-class>
51
    <body-content>JSP</body-content>
52
  </tag>
53
54
  <tag>
55
    <description>
56
	Simple conditional tag, which evalutes its body if the
57
	supplied condition is true and optionally exposes a Boolean
58
	scripting variable representing the evaluation of this condition
59
    </description>
60
    <name>if</name>
61
    <tag-class>org.apache.taglibs.standard.tag.rt.core.IfTag</tag-class>
62
    <body-content>JSP</body-content>
63
    <attribute>
64
        <description>
24
        <description>
65
The test condition that determines whether or
25
            Catches any Throwable that occurs in its body and optionally
66
not the body content should be processed.
26
            exposes it.
67
        </description>
27
        </description>
68
        <name>test</name>
28
        <name>catch</name>
69
        <required>true</required>
29
        <tag-class>org.apache.taglibs.standard.tag.common.core.CatchTag</tag-class>
70
        <rtexprvalue>true</rtexprvalue>
30
        <body-content>JSP</body-content>
71
	<type>boolean</type>
31
        <attribute>
72
    </attribute>
32
            <description>
73
    <attribute>
33
                Name of the exported scoped variable for the
34
                exception thrown from a nested action. The type of the
35
                scoped variable is the type of the exception thrown.
36
            </description>
37
            <name>var</name>
38
            <required>false</required>
39
            <rtexprvalue>false</rtexprvalue>
40
        </attribute>
41
    </tag>
42
43
    <tag>
74
        <description>
44
        <description>
75
Name of the exported scoped variable for the
45
            Simple conditional tag that establishes a context for
76
resulting value of the test condition. The type
46
            mutually exclusive conditional operations, marked by
77
of the scoped variable is Boolean.        
47
            &lt;when&gt; and &lt;otherwise&gt;
78
        </description>
48
        </description>
79
        <name>var</name>
49
        <name>choose</name>
80
        <required>false</required>
50
        <tag-class>org.apache.taglibs.standard.tag.common.core.ChooseTag</tag-class>
81
        <rtexprvalue>false</rtexprvalue>
51
        <body-content>JSP</body-content>
82
    </attribute>
52
    </tag>
83
    <attribute>
53
54
    <tag>
84
        <description>
55
        <description>
85
Scope for var.
56
            Simple conditional tag, which evalutes its body if the
57
            supplied condition is true and optionally exposes a Boolean
58
            scripting variable representing the evaluation of this condition
86
        </description>
59
        </description>
87
        <name>scope</name>
60
        <name>if</name>
88
        <required>false</required>
61
        <tag-class>org.apache.taglibs.standard.tag.rt.core.IfTag</tag-class>
89
        <rtexprvalue>false</rtexprvalue>
62
        <body-content>JSP</body-content>
90
    </attribute>
63
        <attribute>
91
  </tag>
64
            <description>
65
                The test condition that determines whether or
66
                not the body content should be processed.
67
            </description>
68
            <name>test</name>
69
            <required>true</required>
70
            <rtexprvalue>true</rtexprvalue>
71
            <type>boolean</type>
72
        </attribute>
73
        <attribute>
74
            <description>
75
                Name of the exported scoped variable for the
76
                resulting value of the test condition. The type
77
                of the scoped variable is Boolean.
78
            </description>
79
            <name>var</name>
80
            <required>false</required>
81
            <rtexprvalue>false</rtexprvalue>
82
        </attribute>
83
        <attribute>
84
            <description>
85
                Scope for var.
86
            </description>
87
            <name>scope</name>
88
            <required>false</required>
89
            <rtexprvalue>false</rtexprvalue>
90
        </attribute>
91
    </tag>
92
92
93
  <tag>
93
    <tag>
94
    <description>
95
        Retrieves an absolute or relative URL and exposes its contents
96
        to either the page, a String in 'var', or a Reader in 'varReader'.
97
    </description>
98
    <name>import</name>
99
    <tag-class>org.apache.taglibs.standard.tag.rt.core.ImportTag</tag-class>
100
    <tei-class>org.apache.taglibs.standard.tei.ImportTEI</tei-class>
101
    <body-content>JSP</body-content>
102
    <attribute>
103
        <description>
94
        <description>
104
The URL of the resource to import.
95
            Retrieves an absolute or relative URL and exposes its contents
96
            to either the page, a String in 'var', or a Reader in 'varReader'.
105
        </description>
97
        </description>
106
        <name>url</name>
98
        <name>import</name>
107
        <required>true</required>
99
        <tag-class>org.apache.taglibs.standard.tag.rt.core.ImportTag</tag-class>
108
        <rtexprvalue>true</rtexprvalue>
100
        <tei-class>org.apache.taglibs.standard.tei.ImportTEI</tei-class>
109
    </attribute>
101
        <body-content>JSP</body-content>
110
    <attribute>
102
        <attribute>
111
        <description>
103
            <description>
112
Name of the exported scoped variable for the
104
                The URL of the resource to import.
113
resource's content. The type of the scoped
105
            </description>
114
variable is String.
106
            <name>url</name>
115
        </description>
107
            <required>true</required>
116
        <name>var</name>
108
            <rtexprvalue>true</rtexprvalue>
117
        <required>false</required>
109
        </attribute>
118
        <rtexprvalue>false</rtexprvalue>
110
        <attribute>
119
    </attribute>
111
            <description>
120
    <attribute>
112
                Name of the exported scoped variable for the
121
        <description>
113
                resource's content. The type of the scoped
122
Scope for var.
114
                variable is String.
123
        </description>
115
            </description>
124
        <name>scope</name>
116
            <name>var</name>
125
        <required>false</required>
117
            <required>false</required>
126
        <rtexprvalue>false</rtexprvalue>
118
            <rtexprvalue>false</rtexprvalue>
127
    </attribute>
119
        </attribute>
128
    <attribute>
120
        <attribute>
129
        <description>
121
            <description>
130
Name of the exported scoped variable for the
122
                Scope for var.
131
resource's content. The type of the scoped
123
            </description>
132
variable is Reader.
124
            <name>scope</name>
133
        </description>
125
            <required>false</required>
134
        <name>varReader</name>
126
            <rtexprvalue>false</rtexprvalue>
135
        <required>false</required>
127
        </attribute>
136
        <rtexprvalue>false</rtexprvalue>
128
        <attribute>
137
    </attribute>
129
            <description>
138
    <attribute>
130
                Name of the exported scoped variable for the
139
        <description>
131
                resource's content. The type of the scoped
140
Name of the context when accessing a relative
132
                variable is Reader.
141
URL resource that belongs to a foreign
133
            </description>
142
context.
134
            <name>varReader</name>
143
        </description>
135
            <required>false</required>
144
        <name>context</name>
136
            <rtexprvalue>false</rtexprvalue>
145
        <required>false</required>
137
        </attribute>
146
        <rtexprvalue>true</rtexprvalue>
138
        <attribute>
147
    </attribute>
139
            <description>
148
    <attribute>
140
                Name of the context when accessing a relative
149
        <description>
141
                URL resource that belongs to a foreign
150
Character encoding of the content at the input
142
                context.
151
resource.
143
            </description>
152
        </description>
144
            <name>context</name>
153
        <name>charEncoding</name>
145
            <required>false</required>
154
        <required>false</required>
146
            <rtexprvalue>true</rtexprvalue>
155
        <rtexprvalue>true</rtexprvalue>
147
        </attribute>
156
    </attribute>
148
        <attribute>
157
  </tag>
149
            <description>
150
                Character encoding of the content at the input
151
                resource.
152
            </description>
153
            <name>charEncoding</name>
154
            <required>false</required>
155
            <rtexprvalue>true</rtexprvalue>
156
        </attribute>
157
    </tag>
158
158
159
  <tag>
159
    <tag>
160
    <description>
161
	The basic iteration tag, accepting many different
162
        collection types and supporting subsetting and other
163
        functionality
164
    </description>
165
    <name>forEach</name>
166
    <tag-class>org.apache.taglibs.standard.tag.rt.core.ForEachTag</tag-class>
167
    <tei-class>org.apache.taglibs.standard.tei.ForEachTEI</tei-class>
168
    <body-content>JSP</body-content>
169
    <attribute>
170
        <description>
160
        <description>
171
Collection of items to iterate over.
161
            The basic iteration tag, accepting many different
162
            collection types and supporting subsetting and other
163
            functionality
172
        </description>
164
        </description>
173
	<name>items</name>
165
        <name>forEach</name>
174
	<required>false</required>
166
        <tag-class>org.apache.taglibs.standard.tag.rt.core.ForEachTag</tag-class>
175
	<rtexprvalue>true</rtexprvalue>
167
        <tei-class>org.apache.taglibs.standard.tei.ForEachTEI</tei-class>
176
	<type>java.lang.Object</type>
168
        <body-content>JSP</body-content>
177
    </attribute>
169
        <attribute>
178
    <attribute>
170
            <description>
179
        <description>
171
                Collection of items to iterate over.
180
If items specified:
172
            </description>
181
Iteration begins at the item located at the
173
            <name>items</name>
182
specified index. First item of the collection has
174
            <required>false</required>
183
index 0.
175
            <rtexprvalue>true</rtexprvalue>
184
If items not specified:
176
            <type>java.lang.Object</type>
185
Iteration begins with index set at the value
177
        </attribute>
186
specified.
178
        <attribute>
187
        </description>
179
            <description>
188
	<name>begin</name>
180
                If items specified:
189
	<required>false</required>
181
                Iteration begins at the item located at the
190
	<rtexprvalue>true</rtexprvalue>
182
                specified index. First item of the collection has
191
	<type>int</type>
183
                index 0.
192
    </attribute>
184
                If items not specified:
193
    <attribute>
185
                Iteration begins with index set at the value
194
        <description>
186
                specified.
195
If items specified:
187
            </description>
196
Iteration ends at the item located at the
188
            <name>begin</name>
197
specified index (inclusive).
189
            <required>false</required>
198
If items not specified:
190
            <rtexprvalue>true</rtexprvalue>
199
Iteration ends when index reaches the value
191
            <type>int</type>
200
specified.
192
        </attribute>
201
        </description>
193
        <attribute>
202
	<name>end</name>
194
            <description>
203
	<required>false</required>
195
                If items specified:
204
	<rtexprvalue>true</rtexprvalue>
196
                Iteration ends at the item located at the
205
	<type>int</type>
197
                specified index (inclusive).
206
    </attribute>
198
                If items not specified:
207
    <attribute>
199
                Iteration ends when index reaches the value
208
        <description>
200
                specified.
209
Iteration will only process every step items of
201
            </description>
210
the collection, starting with the first one.
202
            <name>end</name>
211
        </description>
203
            <required>false</required>
212
	<name>step</name>
204
            <rtexprvalue>true</rtexprvalue>
213
	<required>false</required>
205
            <type>int</type>
214
	<rtexprvalue>true</rtexprvalue>
206
        </attribute>
215
	<type>int</type>
207
        <attribute>
216
    </attribute>
208
            <description>
217
    <attribute>
209
                Iteration will only process every step items of
218
        <description>
210
                the collection, starting with the first one.
219
Name of the exported scoped variable for the
211
            </description>
220
current item of the iteration. This scoped
212
            <name>step</name>
221
variable has nested visibility. Its type depends
213
            <required>false</required>
222
on the object of the underlying collection.
214
            <rtexprvalue>true</rtexprvalue>
223
        </description>
215
            <type>int</type>
224
	<name>var</name>
216
        </attribute>
225
	<required>false</required>
217
        <attribute>
226
	<rtexprvalue>false</rtexprvalue>
218
            <description>
227
    </attribute>
219
                Name of the exported scoped variable for the
228
    <attribute>
220
                current item of the iteration. This scoped
229
        <description>
221
                variable has nested visibility. Its type depends
230
Name of the exported scoped variable for the
222
                on the object of the underlying collection.
231
status of the iteration. Object exported is of type
223
            </description>
232
javax.servlet.jsp.jstl.core.LoopTagStatus. This scoped variable has nested
224
            <name>var</name>
233
visibility.
225
            <required>false</required>
234
        </description>
226
            <rtexprvalue>false</rtexprvalue>
235
	<name>varStatus</name>
227
        </attribute>
236
	<required>false</required>
228
        <attribute>
237
	<rtexprvalue>false</rtexprvalue>
229
            <description>
238
    </attribute>
230
                Name of the exported scoped variable for the
239
  </tag>
231
                status of the iteration. Object exported is of type
232
                javax.servlet.jsp.jstl.core.LoopTagStatus. This scoped variable has nested
233
                visibility.
234
            </description>
235
            <name>varStatus</name>
236
            <required>false</required>
237
            <rtexprvalue>false</rtexprvalue>
238
        </attribute>
239
    </tag>
240
240
241
  <tag>
241
    <tag>
242
    <description>
243
	Iterates over tokens, separated by the supplied delimeters
244
    </description>
245
    <name>forTokens</name>
246
    <tag-class>org.apache.taglibs.standard.tag.rt.core.ForTokensTag</tag-class>
247
    <body-content>JSP</body-content>
248
    <attribute>
249
        <description>
242
        <description>
250
String of tokens to iterate over.
243
            Iterates over tokens, separated by the supplied delimeters
251
        </description>
244
        </description>
252
	<name>items</name>
245
        <name>forTokens</name>
253
	<required>true</required>
246
        <tag-class>org.apache.taglibs.standard.tag.rt.core.ForTokensTag</tag-class>
254
	<rtexprvalue>true</rtexprvalue>
247
        <body-content>JSP</body-content>
255
	<type>java.lang.String</type>
248
        <attribute>
256
    </attribute>
249
            <description>
257
    <attribute>
250
                String of tokens to iterate over.
258
        <description>
251
            </description>
259
The set of delimiters (the characters that
252
            <name>items</name>
260
separate the tokens in the string).
253
            <required>true</required>
261
        </description>
254
            <rtexprvalue>true</rtexprvalue>
262
	<name>delims</name>
255
            <type>java.lang.String</type>
263
	<required>true</required>
256
        </attribute>
264
	<rtexprvalue>true</rtexprvalue>
257
        <attribute>
265
	<type>java.lang.String</type>
258
            <description>
266
    </attribute>
259
                The set of delimiters (the characters that
267
    <attribute>
260
                separate the tokens in the string).
268
        <description>
261
            </description>
269
Iteration begins at the token located at the
262
            <name>delims</name>
270
specified index. First token has index 0.
263
            <required>true</required>
271
        </description>
264
            <rtexprvalue>true</rtexprvalue>
272
	<name>begin</name>
265
            <type>java.lang.String</type>
273
	<required>false</required>
266
        </attribute>
274
	<rtexprvalue>true</rtexprvalue>
267
        <attribute>
275
	<type>int</type>
268
            <description>
276
    </attribute>
269
                Iteration begins at the token located at the
277
    <attribute>
270
                specified index. First token has index 0.
278
        <description>
271
            </description>
279
Iteration ends at the token located at the
272
            <name>begin</name>
280
specified index (inclusive).
273
            <required>false</required>
281
        </description>
274
            <rtexprvalue>true</rtexprvalue>
282
	<name>end</name>
275
            <type>int</type>
283
	<required>false</required>
276
        </attribute>
284
	<rtexprvalue>true</rtexprvalue>
277
        <attribute>
285
	<type>int</type>
278
            <description>
286
    </attribute>
279
                Iteration ends at the token located at the
287
    <attribute>
280
                specified index (inclusive).
288
        <description>
281
            </description>
289
Iteration will only process every step tokens
282
            <name>end</name>
290
of the string, starting with the first one.
283
            <required>false</required>
291
        </description>
284
            <rtexprvalue>true</rtexprvalue>
292
	<name>step</name>
285
            <type>int</type>
293
	<required>false</required>
286
        </attribute>
294
	<rtexprvalue>true</rtexprvalue>
287
        <attribute>
295
	<type>int</type>
288
            <description>
296
    </attribute>
289
                Iteration will only process every step tokens
297
    <attribute>
290
                of the string, starting with the first one.
298
        <description>
291
            </description>
299
Name of the exported scoped variable for the
292
            <name>step</name>
300
current item of the iteration. This scoped
293
            <required>false</required>
301
variable has nested visibility.
294
            <rtexprvalue>true</rtexprvalue>
302
        </description>
295
            <type>int</type>
303
	<name>var</name>
296
        </attribute>
304
	<required>false</required>
297
        <attribute>
305
	<rtexprvalue>false</rtexprvalue>
298
            <description>
306
    </attribute>
299
                Name of the exported scoped variable for the
307
    <attribute>
300
                current item of the iteration. This scoped
308
        <description>
301
                variable has nested visibility.
309
Name of the exported scoped variable for the
302
            </description>
310
status of the iteration. Object exported is of
303
            <name>var</name>
311
type
304
            <required>false</required>
312
javax.servlet.jsp.jstl.core.LoopTag
305
            <rtexprvalue>false</rtexprvalue>
313
Status. This scoped variable has nested
306
        </attribute>
314
visibility.
307
        <attribute>
315
        </description>
308
            <description>
316
	<name>varStatus</name>
309
                Name of the exported scoped variable for the
317
	<required>false</required>
310
                status of the iteration. Object exported is of
318
	<rtexprvalue>false</rtexprvalue>
311
                type
319
    </attribute>
312
                javax.servlet.jsp.jstl.core.LoopTag
320
  </tag>
313
                Status. This scoped variable has nested
314
                visibility.
315
            </description>
316
            <name>varStatus</name>
317
            <required>false</required>
318
            <rtexprvalue>false</rtexprvalue>
319
        </attribute>
320
    </tag>
321
321
322
  <tag>
322
    <tag>
323
    <description>
324
        Like &lt;%= ... &gt;, but for expressions.
325
    </description> 
326
    <name>out</name>
327
    <tag-class>org.apache.taglibs.standard.tag.rt.core.OutTag</tag-class>
328
    <body-content>JSP</body-content>
329
    <attribute>
330
        <description>
323
        <description>
331
Expression to be evaluated.
324
            Like &lt;%= ... &gt;, but for expressions.
332
        </description>
325
        </description>
333
        <name>value</name>
326
        <name>out</name>
334
        <required>true</required>
327
        <tag-class>org.apache.taglibs.standard.tag.rt.core.OutTag</tag-class>
335
        <rtexprvalue>true</rtexprvalue>
328
        <body-content>JSP</body-content>
336
    </attribute>
329
        <attribute>
337
    <attribute>
330
            <description>
338
        <description>
331
                Expression to be evaluated.
339
Default value if the resulting value is null.
332
            </description>
340
        </description>
333
            <name>value</name>
341
        <name>default</name>
334
            <required>true</required>
342
        <required>false</required>
335
            <rtexprvalue>true</rtexprvalue>
343
        <rtexprvalue>true</rtexprvalue>
336
        </attribute>
344
    </attribute>
337
        <attribute>
345
    <attribute>
338
            <description>
346
        <description>
339
                Default value if the resulting value is null.
347
Determines whether characters &lt;,&gt;,&amp;,'," in the
340
            </description>
348
resulting string should be converted to their
341
            <name>default</name>
349
corresponding character entity codes. Default value is
342
            <required>false</required>
350
true.
343
            <rtexprvalue>true</rtexprvalue>
351
        </description>
344
        </attribute>
352
        <name>escapeXml</name>
345
        <attribute>
353
        <required>false</required>
346
            <description>
354
        <rtexprvalue>true</rtexprvalue>
347
                Determines whether characters &lt;,&gt;,&amp;,'," in the
355
    </attribute>
348
                resulting string should be converted to their
356
  </tag>
349
                corresponding character entity codes. Default value is
350
                true.
351
            </description>
352
            <name>escapeXml</name>
353
            <required>false</required>
354
            <rtexprvalue>true</rtexprvalue>
355
        </attribute>
356
    </tag>
357
357
358
358
359
  <tag>
359
    <tag>
360
    <description>
361
        Subtag of &lt;choose&gt; that follows &lt;when&gt; tags
362
        and runs only if all of the prior conditions evaluated to
363
        'false'
364
    </description>
365
    <name>otherwise</name>
366
    <tag-class>org.apache.taglibs.standard.tag.common.core.OtherwiseTag</tag-class>
367
    <body-content>JSP</body-content>
368
  </tag>
369
370
  <tag>
371
    <description>
372
        Adds a parameter to a containing 'import' tag's URL.
373
    </description>
374
    <name>param</name>
375
    <tag-class>org.apache.taglibs.standard.tag.rt.core.ParamTag</tag-class>
376
    <body-content>JSP</body-content>
377
    <attribute>
378
        <description>
360
        <description>
379
Name of the query string parameter.
361
            Subtag of &lt;choose&gt; that follows &lt;when&gt; tags
362
            and runs only if all of the prior conditions evaluated to
363
            'false'
380
        </description>
364
        </description>
381
        <name>name</name>
365
        <name>otherwise</name>
382
        <required>true</required>
366
        <tag-class>org.apache.taglibs.standard.tag.common.core.OtherwiseTag</tag-class>
383
        <rtexprvalue>true</rtexprvalue>
367
        <body-content>JSP</body-content>
384
    </attribute>
368
    </tag>
385
    <attribute>
369
370
    <tag>
386
        <description>
371
        <description>
387
Value of the parameter.
372
            Adds a parameter to a containing 'import' tag's URL.
388
        </description>
373
        </description>
389
        <name>value</name>
374
        <name>param</name>
390
        <required>false</required>
375
        <tag-class>org.apache.taglibs.standard.tag.rt.core.ParamTag</tag-class>
391
        <rtexprvalue>true</rtexprvalue>
376
        <body-content>JSP</body-content>
392
    </attribute>
377
        <attribute>
393
  </tag>
378
            <description>
379
                Name of the query string parameter.
380
            </description>
381
            <name>name</name>
382
            <required>true</required>
383
            <rtexprvalue>true</rtexprvalue>
384
        </attribute>
385
        <attribute>
386
            <description>
387
                Value of the parameter.
388
            </description>
389
            <name>value</name>
390
            <required>false</required>
391
            <rtexprvalue>true</rtexprvalue>
392
        </attribute>
393
    </tag>
394
394
395
  <tag>
395
    <tag>
396
    <description>
397
        Redirects to a new URL.
398
    </description>
399
    <name>redirect</name>
400
    <tag-class>org.apache.taglibs.standard.tag.rt.core.RedirectTag</tag-class>
401
    <body-content>JSP</body-content>
402
    <attribute>
403
        <description>
396
        <description>
404
The URL of the resource to redirect to.
397
            Redirects to a new URL.
405
        </description>
398
        </description>
406
        <name>url</name>
399
        <name>redirect</name>
407
        <required>false</required>
400
        <tag-class>org.apache.taglibs.standard.tag.rt.core.RedirectTag</tag-class>
408
        <rtexprvalue>true</rtexprvalue>
401
        <body-content>JSP</body-content>
409
    </attribute>
402
        <attribute>
410
    <attribute>
403
            <description>
411
        <description>
404
                The URL of the resource to redirect to.
412
Name of the context when redirecting to a relative URL
405
            </description>
413
resource that belongs to a foreign context.
406
            <name>url</name>
414
        </description>
407
            <required>false</required>
415
        <name>context</name>
408
            <rtexprvalue>true</rtexprvalue>
416
        <required>false</required>
409
        </attribute>
417
        <rtexprvalue>true</rtexprvalue>
410
        <attribute>
418
    </attribute>
411
            <description>
419
  </tag>
412
                Name of the context when redirecting to a relative URL
413
                resource that belongs to a foreign context.
414
            </description>
415
            <name>context</name>
416
            <required>false</required>
417
            <rtexprvalue>true</rtexprvalue>
418
        </attribute>
419
    </tag>
420
420
421
  <tag>
421
    <tag>
422
    <description>
423
        Removes a scoped variable (from a particular scope, if specified).
424
    </description>
425
    <name>remove</name>
426
    <tag-class>org.apache.taglibs.standard.tag.common.core.RemoveTag</tag-class>
427
    <body-content>empty</body-content>
428
    <attribute>
429
        <description>
422
        <description>
430
Name of the scoped variable to be removed.
423
            Removes a scoped variable (from a particular scope, if specified).
431
        </description>
424
        </description>
432
        <name>var</name>
425
        <name>remove</name>
433
        <required>true</required>
426
        <tag-class>org.apache.taglibs.standard.tag.common.core.RemoveTag</tag-class>
434
        <rtexprvalue>false</rtexprvalue>
427
        <body-content>empty</body-content>
435
    </attribute>
428
        <attribute>
436
    <attribute>
429
            <description>
437
        <description>
430
                Name of the scoped variable to be removed.
438
Scope for var.
431
            </description>
439
        </description>
432
            <name>var</name>
440
        <name>scope</name>
433
            <required>true</required>
441
        <required>false</required>
434
            <rtexprvalue>false</rtexprvalue>
442
        <rtexprvalue>false</rtexprvalue>
435
        </attribute>
443
    </attribute>
436
        <attribute>
444
  </tag>
437
            <description>
438
                Scope for var.
439
            </description>
440
            <name>scope</name>
441
            <required>false</required>
442
            <rtexprvalue>false</rtexprvalue>
443
        </attribute>
444
    </tag>
445
445
446
 <tag>
446
    <tag>
447
    <description>
448
        Sets the result of an expression evaluation in a 'scope'
449
    </description>
450
    <name>set</name>
451
    <tag-class>org.apache.taglibs.standard.tag.rt.core.SetTag</tag-class>
452
    <body-content>JSP</body-content>
453
    <attribute>
454
        <description>
447
        <description>
455
Name of the exported scoped variable to hold the value
448
            Sets the result of an expression evaluation in a 'scope'
456
specified in the action. The type of the scoped variable is
457
whatever type the value expression evaluates to.
458
        </description>
449
        </description>
459
        <name>var</name>
450
        <name>set</name>
460
        <required>false</required>
451
        <tag-class>org.apache.taglibs.standard.tag.rt.core.SetTag</tag-class>
461
        <rtexprvalue>false</rtexprvalue>
452
        <body-content>JSP</body-content>
462
    </attribute>
453
        <attribute>
463
    <attribute>
454
            <description>
464
        <description>
455
                Name of the exported scoped variable to hold the value
465
Expression to be evaluated.
456
                specified in the action. The type of the scoped variable is
466
        </description>
457
                whatever type the value expression evaluates to.
467
        <name>value</name>
458
            </description>
468
        <required>false</required>
459
            <name>var</name>
469
        <rtexprvalue>true</rtexprvalue>
460
            <required>false</required>
470
    </attribute>
461
            <rtexprvalue>false</rtexprvalue>
471
    <attribute>
462
        </attribute>
472
        <description>
463
        <attribute>
473
Target object whose property will be set. Must evaluate to
464
            <description>
474
a JavaBeans object with setter property property, or to a
465
                Expression to be evaluated.
475
java.util.Map object.
466
            </description>
476
        </description>
467
            <name>value</name>
477
        <name>target</name>
468
            <required>false</required>
478
        <required>false</required>
469
            <rtexprvalue>true</rtexprvalue>
479
        <rtexprvalue>true</rtexprvalue>
470
        </attribute>
480
    </attribute>
471
        <attribute>
481
    <attribute>
472
            <description>
482
        <description>
473
                Target object whose property will be set. Must evaluate to
483
Name of the property to be set in the target object.
474
                a JavaBeans object with setter property property, or to a
484
        </description>
475
                java.util.Map object.
485
        <name>property</name>
476
            </description>
486
        <required>false</required>
477
            <name>target</name>
487
        <rtexprvalue>true</rtexprvalue>
478
            <required>false</required>
488
    </attribute>
479
            <rtexprvalue>true</rtexprvalue>
489
    <attribute>
480
        </attribute>
490
        <description>
481
        <attribute>
491
Scope for var.
482
            <description>
492
        </description>
483
                Name of the property to be set in the target object.
493
        <name>scope</name>
484
            </description>
494
        <required>false</required>
485
            <name>property</name>
495
        <rtexprvalue>false</rtexprvalue>
486
            <required>false</required>
496
    </attribute>
487
            <rtexprvalue>true</rtexprvalue>
497
  </tag>
488
        </attribute>
489
        <attribute>
490
            <description>
491
                Scope for var.
492
            </description>
493
            <name>scope</name>
494
            <required>false</required>
495
            <rtexprvalue>false</rtexprvalue>
496
        </attribute>
497
    </tag>
498
498
499
  <tag>
499
    <tag>
500
    <description>
501
        Creates a URL with optional query parameters.
502
    </description>
503
    <name>url</name>
504
    <tag-class>org.apache.taglibs.standard.tag.rt.core.UrlTag</tag-class>
505
    <body-content>JSP</body-content>
506
    <attribute>
507
        <description>
500
        <description>
508
Name of the exported scoped variable for the
501
            Creates a URL with optional query parameters.
509
processed url. The type of the scoped variable is
510
String.
511
        </description>
502
        </description>
512
        <name>var</name>
503
        <name>url</name>
513
        <required>false</required>
504
        <tag-class>org.apache.taglibs.standard.tag.rt.core.UrlTag</tag-class>
514
        <rtexprvalue>false</rtexprvalue>
505
        <body-content>JSP</body-content>
515
    </attribute>
506
        <attribute>
516
    <attribute>
507
            <description>
517
        <description>
508
                Name of the exported scoped variable for the
518
Scope for var.
509
                processed url. The type of the scoped variable is
519
        </description>
510
                String.
520
        <name>scope</name>
511
            </description>
521
        <required>false</required>
512
            <name>var</name>
522
        <rtexprvalue>false</rtexprvalue>
513
            <required>false</required>
523
    </attribute>
514
            <rtexprvalue>false</rtexprvalue>
524
    <attribute>
515
        </attribute>
525
        <description>
516
        <attribute>
526
URL to be processed.
517
            <description>
527
        </description>
518
                Scope for var.
528
        <name>value</name>
519
            </description>
529
        <required>false</required>
520
            <name>scope</name>
530
        <rtexprvalue>true</rtexprvalue>
521
            <required>false</required>
531
    </attribute>
522
            <rtexprvalue>false</rtexprvalue>
532
    <attribute>
523
        </attribute>
533
        <description>
524
        <attribute>
534
Name of the context when specifying a relative URL
525
            <description>
535
resource that belongs to a foreign context.
526
                URL to be processed.
536
        </description>
527
            </description>
537
        <name>context</name>
528
            <name>value</name>
538
        <required>false</required>
529
            <required>false</required>
539
        <rtexprvalue>true</rtexprvalue>
530
            <rtexprvalue>true</rtexprvalue>
540
    </attribute>
531
        </attribute>
541
  </tag>
532
        <attribute>
533
            <description>
534
                Name of the context when specifying a relative URL
535
                resource that belongs to a foreign context.
536
            </description>
537
            <name>context</name>
538
            <required>false</required>
539
            <rtexprvalue>true</rtexprvalue>
540
        </attribute>
541
    </tag>
542
542
543
  <tag>
543
    <tag>
544
    <description>
545
	Subtag of &lt;choose&gt; that includes its body if its
546
	condition evalutes to 'true'
547
    </description>
548
    <name>when</name>
549
    <tag-class>org.apache.taglibs.standard.tag.rt.core.WhenTag</tag-class>
550
    <body-content>JSP</body-content>
551
    <attribute>
552
        <description>
544
        <description>
553
The test condition that determines whether or not the
545
            Subtag of &lt;choose&gt; that includes its body if its
554
body content should be processed.
546
            condition evalutes to 'true'
555
        </description>
547
        </description>
556
        <name>test</name>
548
        <name>when</name>
557
        <required>true</required>
549
        <tag-class>org.apache.taglibs.standard.tag.rt.core.WhenTag</tag-class>
558
        <rtexprvalue>true</rtexprvalue>
550
        <body-content>JSP</body-content>
559
	<type>boolean</type>
551
        <attribute>
560
    </attribute>
552
            <description>
561
  </tag>
553
                The test condition that determines whether or not the
554
                body content should be processed.
555
            </description>
556
            <name>test</name>
557
            <required>true</required>
558
            <rtexprvalue>true</rtexprvalue>
559
            <type>boolean</type>
560
        </attribute>
561
    </tag>
562
562
563
</taglib>
563
</taglib>
(-)src/main/resources/META-INF/c-1_0-rt.tld (-372 / +372 lines)
Lines 1-393 Link Here
1
<?xml version="1.0" encoding="ISO-8859-1" ?>
1
<?xml version="1.0" encoding="ISO-8859-1" ?>
2
<!DOCTYPE taglib
2
<!DOCTYPE taglib
3
  PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
3
        PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
4
  "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
4
        "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
5
<taglib>
5
<taglib>
6
  <tlib-version>1.0</tlib-version>
6
    <tlib-version>1.0</tlib-version>
7
  <jsp-version>1.2</jsp-version>
7
    <jsp-version>1.2</jsp-version>
8
  <short-name>c_rt</short-name>
8
    <short-name>c_rt</short-name>
9
  <uri>http://java.sun.com/jstl/core_rt</uri>
9
    <uri>http://java.sun.com/jstl/core_rt</uri>
10
  <display-name>JSTL core RT</display-name>
10
    <display-name>JSTL core RT</display-name>
11
  <description>JSTL 1.0 core library</description>
11
    <description>JSTL 1.0 core library</description>
12
12
13
  <validator>
13
    <validator>
14
    <validator-class>
14
        <validator-class>
15
        org.apache.taglibs.standard.tlv.JstlCoreTLV
15
            org.apache.taglibs.standard.tlv.JstlCoreTLV
16
    </validator-class>
16
        </validator-class>
17
    <description>
17
        <description>
18
        Provides core validation features for JSTL tags.
18
            Provides core validation features for JSTL tags.
19
    </description>
19
        </description>
20
  </validator>
20
    </validator>
21
21
22
  <tag>
22
    <tag>
23
    <name>catch</name>
23
        <name>catch</name>
24
    <tag-class>org.apache.taglibs.standard.tag.common.core.CatchTag</tag-class>
24
        <tag-class>org.apache.taglibs.standard.tag.common.core.CatchTag</tag-class>
25
    <body-content>JSP</body-content>
25
        <body-content>JSP</body-content>
26
    <description>
26
        <description>
27
        Catches any Throwable that occurs in its body and optionally
27
            Catches any Throwable that occurs in its body and optionally
28
        exposes it.
28
            exposes it.
29
    </description>
29
        </description>
30
    <attribute>
30
        <attribute>
31
        <name>var</name>
31
            <name>var</name>
32
        <required>false</required>
32
            <required>false</required>
33
        <rtexprvalue>false</rtexprvalue>
33
            <rtexprvalue>false</rtexprvalue>
34
    </attribute>
34
        </attribute>
35
  </tag>
35
    </tag>
36
36
37
  <tag>
37
    <tag>
38
    <name>choose</name>
38
        <name>choose</name>
39
    <tag-class>org.apache.taglibs.standard.tag.common.core.ChooseTag</tag-class>
39
        <tag-class>org.apache.taglibs.standard.tag.common.core.ChooseTag</tag-class>
40
    <body-content>JSP</body-content>
40
        <body-content>JSP</body-content>
41
    <description>
41
        <description>
42
	Simple conditional tag that establishes a context for
42
            Simple conditional tag that establishes a context for
43
	mutually exclusive conditional operations, marked by
43
            mutually exclusive conditional operations, marked by
44
	&lt;when&gt; and &lt;otherwise&gt;
44
            &lt;when&gt; and &lt;otherwise&gt;
45
    </description>
45
        </description>
46
  </tag>
46
    </tag>
47
47
48
  <tag>
48
    <tag>
49
    <name>if</name>
49
        <name>if</name>
50
    <tag-class>org.apache.taglibs.standard.tag.rt.core.IfTag</tag-class>
50
        <tag-class>org.apache.taglibs.standard.tag.rt.core.IfTag</tag-class>
51
    <body-content>JSP</body-content>
51
        <body-content>JSP</body-content>
52
    <description>
52
        <description>
53
	Simple conditional tag, which evalutes its body if the
53
            Simple conditional tag, which evalutes its body if the
54
	supplied condition is true and optionally exposes a Boolean
54
            supplied condition is true and optionally exposes a Boolean
55
	scripting variable representing the evaluation of this condition
55
            scripting variable representing the evaluation of this condition
56
    </description>
56
        </description>
57
    <attribute>
57
        <attribute>
58
        <name>test</name>
58
            <name>test</name>
59
        <required>true</required>
59
            <required>true</required>
60
        <rtexprvalue>true</rtexprvalue>
60
            <rtexprvalue>true</rtexprvalue>
61
	<type>boolean</type>
61
            <type>boolean</type>
62
    </attribute>
62
        </attribute>
63
    <attribute>
63
        <attribute>
64
        <name>var</name>
64
            <name>var</name>
65
        <required>false</required>
65
            <required>false</required>
66
        <rtexprvalue>false</rtexprvalue>
66
            <rtexprvalue>false</rtexprvalue>
67
    </attribute>
67
        </attribute>
68
    <attribute>
68
        <attribute>
69
        <name>scope</name>
69
            <name>scope</name>
70
        <required>false</required>
70
            <required>false</required>
71
        <rtexprvalue>false</rtexprvalue>
71
            <rtexprvalue>false</rtexprvalue>
72
    </attribute>
72
        </attribute>
73
  </tag>
73
    </tag>
74
74
75
  <tag>
75
    <tag>
76
    <name>import</name>
76
        <name>import</name>
77
    <tag-class>org.apache.taglibs.standard.tag.rt.core.ImportTag</tag-class>
77
        <tag-class>org.apache.taglibs.standard.tag.rt.core.ImportTag</tag-class>
78
    <tei-class>org.apache.taglibs.standard.tei.ImportTEI</tei-class>
78
        <tei-class>org.apache.taglibs.standard.tei.ImportTEI</tei-class>
79
    <body-content>JSP</body-content>
79
        <body-content>JSP</body-content>
80
    <description>
80
        <description>
81
        Retrieves an absolute or relative URL and exposes its contents
81
            Retrieves an absolute or relative URL and exposes its contents
82
        to either the page, a String in 'var', or a Reader in 'varReader'.
82
            to either the page, a String in 'var', or a Reader in 'varReader'.
83
    </description>
83
        </description>
84
    <attribute>
84
        <attribute>
85
        <name>url</name>
85
            <name>url</name>
86
        <required>true</required>
86
            <required>true</required>
87
        <rtexprvalue>true</rtexprvalue>
87
            <rtexprvalue>true</rtexprvalue>
88
    </attribute>
88
        </attribute>
89
    <attribute>
89
        <attribute>
90
        <name>var</name>
90
            <name>var</name>
91
        <required>false</required>
91
            <required>false</required>
92
        <rtexprvalue>false</rtexprvalue>
92
            <rtexprvalue>false</rtexprvalue>
93
    </attribute>
93
        </attribute>
94
    <attribute>
94
        <attribute>
95
        <name>scope</name>
95
            <name>scope</name>
96
        <required>false</required>
96
            <required>false</required>
97
        <rtexprvalue>false</rtexprvalue>
97
            <rtexprvalue>false</rtexprvalue>
98
    </attribute>
98
        </attribute>
99
    <attribute>
99
        <attribute>
100
        <name>varReader</name>
100
            <name>varReader</name>
101
        <required>false</required>
101
            <required>false</required>
102
        <rtexprvalue>false</rtexprvalue>
102
            <rtexprvalue>false</rtexprvalue>
103
    </attribute>
103
        </attribute>
104
    <attribute>
104
        <attribute>
105
        <name>context</name>
105
            <name>context</name>
106
        <required>false</required>
106
            <required>false</required>
107
        <rtexprvalue>true</rtexprvalue>
107
            <rtexprvalue>true</rtexprvalue>
108
    </attribute>
108
        </attribute>
109
    <attribute>
109
        <attribute>
110
        <name>charEncoding</name>
110
            <name>charEncoding</name>
111
        <required>false</required>
111
            <required>false</required>
112
        <rtexprvalue>true</rtexprvalue>
112
            <rtexprvalue>true</rtexprvalue>
113
    </attribute>
113
        </attribute>
114
  </tag>
114
    </tag>
115
115
116
  <tag>
116
    <tag>
117
    <name>forEach</name>
117
        <name>forEach</name>
118
    <tag-class>org.apache.taglibs.standard.tag.rt.core.ForEachTag</tag-class>
118
        <tag-class>org.apache.taglibs.standard.tag.rt.core.ForEachTag</tag-class>
119
    <tei-class>org.apache.taglibs.standard.tei.ForEachTEI</tei-class>
119
        <tei-class>org.apache.taglibs.standard.tei.ForEachTEI</tei-class>
120
    <body-content>JSP</body-content>
120
        <body-content>JSP</body-content>
121
    <description>
121
        <description>
122
	The basic iteration tag, accepting many different
122
            The basic iteration tag, accepting many different
123
        collection types and supporting subsetting and other
123
            collection types and supporting subsetting and other
124
        functionality
124
            functionality
125
    </description>
125
        </description>
126
    <attribute>
126
        <attribute>
127
	<name>items</name>
127
            <name>items</name>
128
	<required>false</required>
128
            <required>false</required>
129
	<rtexprvalue>true</rtexprvalue>
129
            <rtexprvalue>true</rtexprvalue>
130
	<type>java.lang.Object</type>
130
            <type>java.lang.Object</type>
131
    </attribute>
131
        </attribute>
132
    <attribute>
132
        <attribute>
133
	<name>begin</name>
133
            <name>begin</name>
134
	<required>false</required>
134
            <required>false</required>
135
	<rtexprvalue>true</rtexprvalue>
135
            <rtexprvalue>true</rtexprvalue>
136
	<type>int</type>
136
            <type>int</type>
137
    </attribute>
137
        </attribute>
138
    <attribute>
138
        <attribute>
139
	<name>end</name>
139
            <name>end</name>
140
	<required>false</required>
140
            <required>false</required>
141
	<rtexprvalue>true</rtexprvalue>
141
            <rtexprvalue>true</rtexprvalue>
142
	<type>int</type>
142
            <type>int</type>
143
    </attribute>
143
        </attribute>
144
    <attribute>
144
        <attribute>
145
	<name>step</name>
145
            <name>step</name>
146
	<required>false</required>
146
            <required>false</required>
147
	<rtexprvalue>true</rtexprvalue>
147
            <rtexprvalue>true</rtexprvalue>
148
	<type>int</type>
148
            <type>int</type>
149
    </attribute>
149
        </attribute>
150
    <attribute>
150
        <attribute>
151
	<name>var</name>
151
            <name>var</name>
152
	<required>false</required>
152
            <required>false</required>
153
	<rtexprvalue>false</rtexprvalue>
153
            <rtexprvalue>false</rtexprvalue>
154
    </attribute>
154
        </attribute>
155
    <attribute>
155
        <attribute>
156
	<name>varStatus</name>
156
            <name>varStatus</name>
157
	<required>false</required>
157
            <required>false</required>
158
	<rtexprvalue>false</rtexprvalue>
158
            <rtexprvalue>false</rtexprvalue>
159
    </attribute>
159
        </attribute>
160
  </tag>
160
    </tag>
161
161
162
  <tag>
162
    <tag>
163
    <name>forTokens</name>
163
        <name>forTokens</name>
164
    <tag-class>org.apache.taglibs.standard.tag.rt.core.ForTokensTag</tag-class>
164
        <tag-class>org.apache.taglibs.standard.tag.rt.core.ForTokensTag</tag-class>
165
    <body-content>JSP</body-content>
165
        <body-content>JSP</body-content>
166
    <description>
166
        <description>
167
	Iterates over tokens, separated by the supplied delimeters
167
            Iterates over tokens, separated by the supplied delimeters
168
    </description>
168
        </description>
169
    <attribute>
169
        <attribute>
170
	<name>items</name>
170
            <name>items</name>
171
	<required>true</required>
171
            <required>true</required>
172
	<rtexprvalue>true</rtexprvalue>
172
            <rtexprvalue>true</rtexprvalue>
173
	<type>java.lang.String</type>
173
            <type>java.lang.String</type>
174
    </attribute>
174
        </attribute>
175
    <attribute>
175
        <attribute>
176
	<name>delims</name>
176
            <name>delims</name>
177
	<required>true</required>
177
            <required>true</required>
178
	<rtexprvalue>true</rtexprvalue>
178
            <rtexprvalue>true</rtexprvalue>
179
	<type>java.lang.String</type>
179
            <type>java.lang.String</type>
180
    </attribute>
180
        </attribute>
181
    <attribute>
181
        <attribute>
182
	<name>begin</name>
182
            <name>begin</name>
183
	<required>false</required>
183
            <required>false</required>
184
	<rtexprvalue>true</rtexprvalue>
184
            <rtexprvalue>true</rtexprvalue>
185
	<type>int</type>
185
            <type>int</type>
186
    </attribute>
186
        </attribute>
187
    <attribute>
187
        <attribute>
188
	<name>end</name>
188
            <name>end</name>
189
	<required>false</required>
189
            <required>false</required>
190
	<rtexprvalue>true</rtexprvalue>
190
            <rtexprvalue>true</rtexprvalue>
191
	<type>int</type>
191
            <type>int</type>
192
    </attribute>
192
        </attribute>
193
    <attribute>
193
        <attribute>
194
	<name>step</name>
194
            <name>step</name>
195
	<required>false</required>
195
            <required>false</required>
196
	<rtexprvalue>true</rtexprvalue>
196
            <rtexprvalue>true</rtexprvalue>
197
	<type>int</type>
197
            <type>int</type>
198
    </attribute>
198
        </attribute>
199
    <attribute>
199
        <attribute>
200
	<name>var</name>
200
            <name>var</name>
201
	<required>false</required>
201
            <required>false</required>
202
	<rtexprvalue>false</rtexprvalue>
202
            <rtexprvalue>false</rtexprvalue>
203
    </attribute>
203
        </attribute>
204
    <attribute>
204
        <attribute>
205
	<name>varStatus</name>
205
            <name>varStatus</name>
206
	<required>false</required>
206
            <required>false</required>
207
	<rtexprvalue>false</rtexprvalue>
207
            <rtexprvalue>false</rtexprvalue>
208
    </attribute>
208
        </attribute>
209
  </tag>
209
    </tag>
210
210
211
  <tag>
211
    <tag>
212
    <name>out</name>
212
        <name>out</name>
213
    <tag-class>org.apache.taglibs.standard.tag.rt.core.OutTag</tag-class>
213
        <tag-class>org.apache.taglibs.standard.tag.rt.core.OutTag</tag-class>
214
    <body-content>JSP</body-content>
214
        <body-content>JSP</body-content>
215
    <description>
215
        <description>
216
        Like &lt;%= ... &gt;, but for expressions.
216
            Like &lt;%= ... &gt;, but for expressions.
217
    </description> 
217
        </description>
218
    <attribute>
218
        <attribute>
219
        <name>value</name>
219
            <name>value</name>
220
        <required>true</required>
220
            <required>true</required>
221
        <rtexprvalue>true</rtexprvalue>
221
            <rtexprvalue>true</rtexprvalue>
222
    </attribute>
222
        </attribute>
223
    <attribute>
223
        <attribute>
224
        <name>default</name>
224
            <name>default</name>
225
        <required>false</required>
225
            <required>false</required>
226
        <rtexprvalue>true</rtexprvalue>
226
            <rtexprvalue>true</rtexprvalue>
227
    </attribute>
227
        </attribute>
228
    <attribute>
228
        <attribute>
229
        <name>escapeXml</name>
229
            <name>escapeXml</name>
230
        <required>false</required>
230
            <required>false</required>
231
        <rtexprvalue>true</rtexprvalue>
231
            <rtexprvalue>true</rtexprvalue>
232
    </attribute>
232
        </attribute>
233
  </tag>
233
    </tag>
234
234
235
235
236
  <tag>
236
    <tag>
237
    <name>otherwise</name>
237
        <name>otherwise</name>
238
    <tag-class>org.apache.taglibs.standard.tag.common.core.OtherwiseTag</tag-class>
238
        <tag-class>org.apache.taglibs.standard.tag.common.core.OtherwiseTag</tag-class>
239
    <body-content>JSP</body-content>
239
        <body-content>JSP</body-content>
240
    <description>
240
        <description>
241
        Subtag of &lt;choose&gt; that follows &lt;when&gt; tags
241
            Subtag of &lt;choose&gt; that follows &lt;when&gt; tags
242
        and runs only if all of the prior conditions evaluated to
242
            and runs only if all of the prior conditions evaluated to
243
        'false'
243
            'false'
244
    </description>
244
        </description>
245
  </tag>
245
    </tag>
246
246
247
  <tag>
247
    <tag>
248
    <name>param</name>
248
        <name>param</name>
249
    <tag-class>org.apache.taglibs.standard.tag.rt.core.ParamTag</tag-class>
249
        <tag-class>org.apache.taglibs.standard.tag.rt.core.ParamTag</tag-class>
250
    <body-content>JSP</body-content>
250
        <body-content>JSP</body-content>
251
    <description>
251
        <description>
252
        Adds a parameter to a containing 'import' tag's URL.
252
            Adds a parameter to a containing 'import' tag's URL.
253
    </description>
253
        </description>
254
    <attribute>
254
        <attribute>
255
        <name>name</name>
255
            <name>name</name>
256
        <required>true</required>
256
            <required>true</required>
257
        <rtexprvalue>true</rtexprvalue>
257
            <rtexprvalue>true</rtexprvalue>
258
    </attribute>
258
        </attribute>
259
    <attribute>
259
        <attribute>
260
        <name>value</name>
260
            <name>value</name>
261
        <required>false</required>
261
            <required>false</required>
262
        <rtexprvalue>true</rtexprvalue>
262
            <rtexprvalue>true</rtexprvalue>
263
    </attribute>
263
        </attribute>
264
  </tag>
264
    </tag>
265
265
266
  <tag>
266
    <tag>
267
    <name>redirect</name>
267
        <name>redirect</name>
268
    <tag-class>org.apache.taglibs.standard.tag.rt.core.RedirectTag</tag-class>
268
        <tag-class>org.apache.taglibs.standard.tag.rt.core.RedirectTag</tag-class>
269
    <body-content>JSP</body-content>
269
        <body-content>JSP</body-content>
270
    <description>
270
        <description>
271
        Redirects to a new URL.
271
            Redirects to a new URL.
272
    </description>
272
        </description>
273
    <attribute>
273
        <attribute>
274
        <name>var</name>
274
            <name>var</name>
275
        <required>false</required>
275
            <required>false</required>
276
        <rtexprvalue>false</rtexprvalue>
276
            <rtexprvalue>false</rtexprvalue>
277
    </attribute>
277
        </attribute>
278
    <attribute>
278
        <attribute>
279
        <name>scope</name>
279
            <name>scope</name>
280
        <required>false</required>
280
            <required>false</required>
281
        <rtexprvalue>false</rtexprvalue>
281
            <rtexprvalue>false</rtexprvalue>
282
    </attribute>
282
        </attribute>
283
    <attribute>
283
        <attribute>
284
        <name>url</name>
284
            <name>url</name>
285
        <required>false</required>
285
            <required>false</required>
286
        <rtexprvalue>true</rtexprvalue>
286
            <rtexprvalue>true</rtexprvalue>
287
    </attribute>
287
        </attribute>
288
    <attribute>
288
        <attribute>
289
        <name>context</name>
289
            <name>context</name>
290
        <required>false</required>
290
            <required>false</required>
291
        <rtexprvalue>true</rtexprvalue>
291
            <rtexprvalue>true</rtexprvalue>
292
    </attribute>
292
        </attribute>
293
  </tag>
293
    </tag>
294
294
295
  <tag>
295
    <tag>
296
    <name>remove</name>
296
        <name>remove</name>
297
    <tag-class>org.apache.taglibs.standard.tag.common.core.RemoveTag</tag-class>
297
        <tag-class>org.apache.taglibs.standard.tag.common.core.RemoveTag</tag-class>
298
    <body-content>empty</body-content>
298
        <body-content>empty</body-content>
299
    <description>
299
        <description>
300
        Removes a scoped variable (from a particular scope, if specified).
300
            Removes a scoped variable (from a particular scope, if specified).
301
    </description>
301
        </description>
302
    <attribute>
302
        <attribute>
303
        <name>var</name>
303
            <name>var</name>
304
        <required>true</required>
304
            <required>true</required>
305
        <rtexprvalue>false</rtexprvalue>
305
            <rtexprvalue>false</rtexprvalue>
306
    </attribute>
306
        </attribute>
307
    <attribute>
307
        <attribute>
308
        <name>scope</name>
308
            <name>scope</name>
309
        <required>false</required>
309
            <required>false</required>
310
        <rtexprvalue>false</rtexprvalue>
310
            <rtexprvalue>false</rtexprvalue>
311
    </attribute>
311
        </attribute>
312
  </tag>
312
    </tag>
313
313
314
 <tag>
314
    <tag>
315
    <name>set</name>
315
        <name>set</name>
316
    <tag-class>org.apache.taglibs.standard.tag.rt.core.SetTag</tag-class>
316
        <tag-class>org.apache.taglibs.standard.tag.rt.core.SetTag</tag-class>
317
    <body-content>JSP</body-content>
317
        <body-content>JSP</body-content>
318
    <description>
318
        <description>
319
        Sets the result of an expression evaluation in a 'scope'
319
            Sets the result of an expression evaluation in a 'scope'
320
    </description>
320
        </description>
321
    <attribute>
321
        <attribute>
322
        <name>var</name>
322
            <name>var</name>
323
        <required>false</required>
323
            <required>false</required>
324
        <rtexprvalue>false</rtexprvalue>
324
            <rtexprvalue>false</rtexprvalue>
325
    </attribute>
325
        </attribute>
326
    <attribute>
326
        <attribute>
327
        <name>value</name>
327
            <name>value</name>
328
        <required>false</required>
328
            <required>false</required>
329
        <rtexprvalue>true</rtexprvalue>
329
            <rtexprvalue>true</rtexprvalue>
330
    </attribute>
330
        </attribute>
331
    <attribute>
331
        <attribute>
332
        <name>target</name>
332
            <name>target</name>
333
        <required>false</required>
333
            <required>false</required>
334
        <rtexprvalue>true</rtexprvalue>
334
            <rtexprvalue>true</rtexprvalue>
335
    </attribute>
335
        </attribute>
336
    <attribute>
336
        <attribute>
337
        <name>property</name>
337
            <name>property</name>
338
        <required>false</required>
338
            <required>false</required>
339
        <rtexprvalue>true</rtexprvalue>
339
            <rtexprvalue>true</rtexprvalue>
340
    </attribute>
340
        </attribute>
341
    <attribute>
341
        <attribute>
342
        <name>scope</name>
342
            <name>scope</name>
343
        <required>false</required>
343
            <required>false</required>
344
        <rtexprvalue>false</rtexprvalue>
344
            <rtexprvalue>false</rtexprvalue>
345
    </attribute>
345
        </attribute>
346
  </tag>
346
    </tag>
347
347
348
  <tag>
348
    <tag>
349
    <name>url</name>
349
        <name>url</name>
350
    <tag-class>org.apache.taglibs.standard.tag.rt.core.UrlTag</tag-class>
350
        <tag-class>org.apache.taglibs.standard.tag.rt.core.UrlTag</tag-class>
351
    <body-content>JSP</body-content>
351
        <body-content>JSP</body-content>
352
    <description>
352
        <description>
353
        Creates a URL with optional query parameters.
353
            Creates a URL with optional query parameters.
354
    </description>
354
        </description>
355
    <attribute>
355
        <attribute>
356
        <name>var</name>
356
            <name>var</name>
357
        <required>false</required>
357
            <required>false</required>
358
        <rtexprvalue>false</rtexprvalue>
358
            <rtexprvalue>false</rtexprvalue>
359
    </attribute>
359
        </attribute>
360
    <attribute>
360
        <attribute>
361
        <name>scope</name>
361
            <name>scope</name>
362
        <required>false</required>
362
            <required>false</required>
363
        <rtexprvalue>false</rtexprvalue>
363
            <rtexprvalue>false</rtexprvalue>
364
    </attribute>
364
        </attribute>
365
    <attribute>
365
        <attribute>
366
        <name>value</name>
366
            <name>value</name>
367
        <required>false</required>
367
            <required>false</required>
368
        <rtexprvalue>true</rtexprvalue>
368
            <rtexprvalue>true</rtexprvalue>
369
    </attribute>
369
        </attribute>
370
    <attribute>
370
        <attribute>
371
        <name>context</name>
371
            <name>context</name>
372
        <required>false</required>
372
            <required>false</required>
373
        <rtexprvalue>true</rtexprvalue>
373
            <rtexprvalue>true</rtexprvalue>
374
    </attribute>
374
        </attribute>
375
  </tag>
375
    </tag>
376
376
377
  <tag>
377
    <tag>
378
    <name>when</name>
378
        <name>when</name>
379
    <tag-class>org.apache.taglibs.standard.tag.rt.core.WhenTag</tag-class>
379
        <tag-class>org.apache.taglibs.standard.tag.rt.core.WhenTag</tag-class>
380
    <body-content>JSP</body-content>
380
        <body-content>JSP</body-content>
381
    <description>
381
        <description>
382
	Subtag of &lt;choose&gt; that includes its body if its
382
            Subtag of &lt;choose&gt; that includes its body if its
383
	condition evalutes to 'true'
383
            condition evalutes to 'true'
384
    </description>
384
        </description>
385
    <attribute>
385
        <attribute>
386
        <name>test</name>
386
            <name>test</name>
387
        <required>true</required>
387
            <required>true</required>
388
        <rtexprvalue>true</rtexprvalue>
388
            <rtexprvalue>true</rtexprvalue>
389
	<type>boolean</type>
389
            <type>boolean</type>
390
    </attribute>
390
        </attribute>
391
  </tag>
391
    </tag>
392
392
393
</taglib>
393
</taglib>
(-)src/main/resources/META-INF/c.tld (-523 / +523 lines)
Lines 1-572 Link Here
1
<?xml version="1.0" encoding="UTF-8" ?>
1
<?xml version="1.0" encoding="UTF-8" ?>
2
2
3
<taglib xmlns="http://java.sun.com/xml/ns/javaee"
3
<taglib xmlns="http://java.sun.com/xml/ns/javaee"
4
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd"
5
        xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-jsptaglibrary_2_1.xsd"
6
    version="2.1">
6
        version="2.1">
7
7
8
  <description>JSTL 1.2 core library</description>
8
    <description>JSTL 1.2 core library</description>
9
  <display-name>JSTL core</display-name>
9
    <display-name>JSTL core</display-name>
10
  <tlib-version>1.2</tlib-version>
10
    <tlib-version>1.2</tlib-version>
11
  <short-name>c</short-name>
11
    <short-name>c</short-name>
12
  <uri>http://java.sun.com/jsp/jstl/core</uri>
12
    <uri>http://java.sun.com/jsp/jstl/core</uri>
13
13
14
  <validator>
14
    <validator>
15
    <description>
16
        Provides core validation features for JSTL tags.
17
    </description>
18
    <validator-class>
19
        org.apache.taglibs.standard.tlv.JstlCoreTLV
20
    </validator-class>
21
  </validator>
22
23
  <tag>
24
    <description>
25
        Catches any Throwable that occurs in its body and optionally
26
        exposes it.
27
    </description>
28
    <name>catch</name>
29
    <tag-class>org.apache.taglibs.standard.tag.common.core.CatchTag</tag-class>
30
    <body-content>JSP</body-content>
31
    <attribute>
32
        <description>
15
        <description>
33
Name of the exported scoped variable for the
16
            Provides core validation features for JSTL tags.
34
exception thrown from a nested action. The type of the
35
scoped variable is the type of the exception thrown.
36
        </description>
17
        </description>
37
        <name>var</name>
18
        <validator-class>
38
        <required>false</required>
19
            org.apache.taglibs.standard.tlv.JstlCoreTLV
39
        <rtexprvalue>false</rtexprvalue>
20
        </validator-class>
40
    </attribute>
21
    </validator>
41
  </tag>
42
22
43
  <tag>
23
    <tag>
44
    <description>
45
	Simple conditional tag that establishes a context for
46
	mutually exclusive conditional operations, marked by
47
	&lt;when&gt; and &lt;otherwise&gt;
48
    </description>
49
    <name>choose</name>
50
    <tag-class>org.apache.taglibs.standard.tag.common.core.ChooseTag</tag-class>
51
    <body-content>JSP</body-content>
52
  </tag>
53
54
  <tag>
55
    <description>
56
	Simple conditional tag, which evalutes its body if the
57
	supplied condition is true and optionally exposes a Boolean
58
	scripting variable representing the evaluation of this condition
59
    </description>
60
    <name>if</name>
61
    <tag-class>org.apache.taglibs.standard.tag.rt.core.IfTag</tag-class>
62
    <body-content>JSP</body-content>
63
    <attribute>
64
        <description>
24
        <description>
65
The test condition that determines whether or
25
            Catches any Throwable that occurs in its body and optionally
66
not the body content should be processed.
26
            exposes it.
67
        </description>
27
        </description>
68
        <name>test</name>
28
        <name>catch</name>
69
        <required>true</required>
29
        <tag-class>org.apache.taglibs.standard.tag.common.core.CatchTag</tag-class>
70
        <rtexprvalue>true</rtexprvalue>
30
        <body-content>JSP</body-content>
71
	<type>boolean</type>
31
        <attribute>
72
    </attribute>
32
            <description>
73
    <attribute>
33
                Name of the exported scoped variable for the
34
                exception thrown from a nested action. The type of the
35
                scoped variable is the type of the exception thrown.
36
            </description>
37
            <name>var</name>
38
            <required>false</required>
39
            <rtexprvalue>false</rtexprvalue>
40
        </attribute>
41
    </tag>
42
43
    <tag>
74
        <description>
44
        <description>
75
Name of the exported scoped variable for the
45
            Simple conditional tag that establishes a context for
76
resulting value of the test condition. The type
46
            mutually exclusive conditional operations, marked by
77
of the scoped variable is Boolean.        
47
            &lt;when&gt; and &lt;otherwise&gt;
78
        </description>
48
        </description>
79
        <name>var</name>
49
        <name>choose</name>
80
        <required>false</required>
50
        <tag-class>org.apache.taglibs.standard.tag.common.core.ChooseTag</tag-class>
81
        <rtexprvalue>false</rtexprvalue>
51
        <body-content>JSP</body-content>
82
    </attribute>
52
    </tag>
83
    <attribute>
53
54
    <tag>
84
        <description>
55
        <description>
85
Scope for var.
56
            Simple conditional tag, which evalutes its body if the
57
            supplied condition is true and optionally exposes a Boolean
58
            scripting variable representing the evaluation of this condition
86
        </description>
59
        </description>
87
        <name>scope</name>
60
        <name>if</name>
88
        <required>false</required>
61
        <tag-class>org.apache.taglibs.standard.tag.rt.core.IfTag</tag-class>
89
        <rtexprvalue>false</rtexprvalue>
62
        <body-content>JSP</body-content>
90
    </attribute>
63
        <attribute>
91
  </tag>
64
            <description>
65
                The test condition that determines whether or
66
                not the body content should be processed.
67
            </description>
68
            <name>test</name>
69
            <required>true</required>
70
            <rtexprvalue>true</rtexprvalue>
71
            <type>boolean</type>
72
        </attribute>
73
        <attribute>
74
            <description>
75
                Name of the exported scoped variable for the
76
                resulting value of the test condition. The type
77
                of the scoped variable is Boolean.
78
            </description>
79
            <name>var</name>
80
            <required>false</required>
81
            <rtexprvalue>false</rtexprvalue>
82
        </attribute>
83
        <attribute>
84
            <description>
85
                Scope for var.
86
            </description>
87
            <name>scope</name>
88
            <required>false</required>
89
            <rtexprvalue>false</rtexprvalue>
90
        </attribute>
91
    </tag>
92
92
93
  <tag>
93
    <tag>
94
    <description>
95
        Retrieves an absolute or relative URL and exposes its contents
96
        to either the page, a String in 'var', or a Reader in 'varReader'.
97
    </description>
98
    <name>import</name>
99
    <tag-class>org.apache.taglibs.standard.tag.rt.core.ImportTag</tag-class>
100
    <tei-class>org.apache.taglibs.standard.tei.ImportTEI</tei-class>
101
    <body-content>JSP</body-content>
102
    <attribute>
103
        <description>
94
        <description>
104
The URL of the resource to import.
95
            Retrieves an absolute or relative URL and exposes its contents
96
            to either the page, a String in 'var', or a Reader in 'varReader'.
105
        </description>
97
        </description>
106
        <name>url</name>
98
        <name>import</name>
107
        <required>true</required>
99
        <tag-class>org.apache.taglibs.standard.tag.rt.core.ImportTag</tag-class>
108
        <rtexprvalue>true</rtexprvalue>
100
        <tei-class>org.apache.taglibs.standard.tei.ImportTEI</tei-class>
109
    </attribute>
101
        <body-content>JSP</body-content>
110
    <attribute>
102
        <attribute>
111
        <description>
103
            <description>
112
Name of the exported scoped variable for the
104
                The URL of the resource to import.
113
resource's content. The type of the scoped
105
            </description>
114
variable is String.
106
            <name>url</name>
115
        </description>
107
            <required>true</required>
116
        <name>var</name>
108
            <rtexprvalue>true</rtexprvalue>
117
        <required>false</required>
109
        </attribute>
118
        <rtexprvalue>false</rtexprvalue>
110
        <attribute>
119
    </attribute>
111
            <description>
120
    <attribute>
112
                Name of the exported scoped variable for the
121
        <description>
113
                resource's content. The type of the scoped
122
Scope for var.
114
                variable is String.
123
        </description>
115
            </description>
124
        <name>scope</name>
116
            <name>var</name>
125
        <required>false</required>
117
            <required>false</required>
126
        <rtexprvalue>false</rtexprvalue>
118
            <rtexprvalue>false</rtexprvalue>
127
    </attribute>
119
        </attribute>
128
    <attribute>
120
        <attribute>
129
        <description>
121
            <description>
130
Name of the exported scoped variable for the
122
                Scope for var.
131
resource's content. The type of the scoped
123
            </description>
132
variable is Reader.
124
            <name>scope</name>
133
        </description>
125
            <required>false</required>
134
        <name>varReader</name>
126
            <rtexprvalue>false</rtexprvalue>
135
        <required>false</required>
127
        </attribute>
136
        <rtexprvalue>false</rtexprvalue>
128
        <attribute>
137
    </attribute>
129
            <description>
138
    <attribute>
130
                Name of the exported scoped variable for the
139
        <description>
131
                resource's content. The type of the scoped
140
Name of the context when accessing a relative
132
                variable is Reader.
141
URL resource that belongs to a foreign
133
            </description>
142
context.
134
            <name>varReader</name>
143
        </description>
135
            <required>false</required>
144
        <name>context</name>
136
            <rtexprvalue>false</rtexprvalue>
145
        <required>false</required>
137
        </attribute>
146
        <rtexprvalue>true</rtexprvalue>
138
        <attribute>
147
    </attribute>
139
            <description>
148
    <attribute>
140
                Name of the context when accessing a relative
149
        <description>
141
                URL resource that belongs to a foreign
150
Character encoding of the content at the input
142
                context.
151
resource.
143
            </description>
152
        </description>
144
            <name>context</name>
153
        <name>charEncoding</name>
145
            <required>false</required>
154
        <required>false</required>
146
            <rtexprvalue>true</rtexprvalue>
155
        <rtexprvalue>true</rtexprvalue>
147
        </attribute>
156
    </attribute>
148
        <attribute>
157
  </tag>
149
            <description>
150
                Character encoding of the content at the input
151
                resource.
152
            </description>
153
            <name>charEncoding</name>
154
            <required>false</required>
155
            <rtexprvalue>true</rtexprvalue>
156
        </attribute>
157
    </tag>
158
158
159
  <tag>
159
    <tag>
160
    <description>
161
	The basic iteration tag, accepting many different
162
        collection types and supporting subsetting and other
163
        functionality
164
    </description>
165
    <name>forEach</name>
166
    <tag-class>org.apache.taglibs.standard.tag.rt.core.ForEachTag</tag-class>
167
    <tei-class>org.apache.taglibs.standard.tei.ForEachTEI</tei-class>
168
    <body-content>JSP</body-content>
169
    <attribute>
170
        <description>
160
        <description>
171
Collection of items to iterate over.
161
            The basic iteration tag, accepting many different
162
            collection types and supporting subsetting and other
163
            functionality
172
        </description>
164
        </description>
173
	<name>items</name>
165
        <name>forEach</name>
174
	<required>false</required>
166
        <tag-class>org.apache.taglibs.standard.tag.rt.core.ForEachTag</tag-class>
175
	<rtexprvalue>true</rtexprvalue>
167
        <tei-class>org.apache.taglibs.standard.tei.ForEachTEI</tei-class>
176
	<type>java.lang.Object</type>
168
        <body-content>JSP</body-content>
177
	<deferred-value>
169
        <attribute>
178
	    <type>java.lang.Object</type>
170
            <description>
179
    </deferred-value>
171
                Collection of items to iterate over.
180
    </attribute>
172
            </description>
181
    <attribute>
173
            <name>items</name>
182
        <description>
174
            <required>false</required>
183
If items specified:
175
            <rtexprvalue>true</rtexprvalue>
184
Iteration begins at the item located at the
176
            <type>java.lang.Object</type>
185
specified index. First item of the collection has
177
            <deferred-value>
186
index 0.
178
                <type>java.lang.Object</type>
187
If items not specified:
179
            </deferred-value>
188
Iteration begins with index set at the value
180
        </attribute>
189
specified.
181
        <attribute>
190
        </description>
182
            <description>
191
	<name>begin</name>
183
                If items specified:
192
	<required>false</required>
184
                Iteration begins at the item located at the
193
	<rtexprvalue>true</rtexprvalue>
185
                specified index. First item of the collection has
194
	<type>int</type>
186
                index 0.
195
    </attribute>
187
                If items not specified:
196
    <attribute>
188
                Iteration begins with index set at the value
197
        <description>
189
                specified.
198
If items specified:
190
            </description>
199
Iteration ends at the item located at the
191
            <name>begin</name>
200
specified index (inclusive).
192
            <required>false</required>
201
If items not specified:
193
            <rtexprvalue>true</rtexprvalue>
202
Iteration ends when index reaches the value
194
            <type>int</type>
203
specified.
195
        </attribute>
204
        </description>
196
        <attribute>
205
	<name>end</name>
197
            <description>
206
	<required>false</required>
198
                If items specified:
207
	<rtexprvalue>true</rtexprvalue>
199
                Iteration ends at the item located at the
208
	<type>int</type>
200
                specified index (inclusive).
209
    </attribute>
201
                If items not specified:
210
    <attribute>
202
                Iteration ends when index reaches the value
211
        <description>
203
                specified.
212
Iteration will only process every step items of
204
            </description>
213
the collection, starting with the first one.
205
            <name>end</name>
214
        </description>
206
            <required>false</required>
215
	<name>step</name>
207
            <rtexprvalue>true</rtexprvalue>
216
	<required>false</required>
208
            <type>int</type>
217
	<rtexprvalue>true</rtexprvalue>
209
        </attribute>
218
	<type>int</type>
210
        <attribute>
219
    </attribute>
211
            <description>
220
    <attribute>
212
                Iteration will only process every step items of
221
        <description>
213
                the collection, starting with the first one.
222
Name of the exported scoped variable for the
214
            </description>
223
current item of the iteration. This scoped
215
            <name>step</name>
224
variable has nested visibility. Its type depends
216
            <required>false</required>
225
on the object of the underlying collection.
217
            <rtexprvalue>true</rtexprvalue>
226
        </description>
218
            <type>int</type>
227
	<name>var</name>
219
        </attribute>
228
	<required>false</required>
220
        <attribute>
229
	<rtexprvalue>false</rtexprvalue>
221
            <description>
230
    </attribute>
222
                Name of the exported scoped variable for the
231
    <attribute>
223
                current item of the iteration. This scoped
232
        <description>
224
                variable has nested visibility. Its type depends
233
Name of the exported scoped variable for the
225
                on the object of the underlying collection.
234
status of the iteration. Object exported is of type
226
            </description>
235
javax.servlet.jsp.jstl.core.LoopTagStatus. This scoped variable has nested
227
            <name>var</name>
236
visibility.
228
            <required>false</required>
237
        </description>
229
            <rtexprvalue>false</rtexprvalue>
238
	<name>varStatus</name>
230
        </attribute>
239
	<required>false</required>
231
        <attribute>
240
	<rtexprvalue>false</rtexprvalue>
232
            <description>
241
    </attribute>
233
                Name of the exported scoped variable for the
242
  </tag>
234
                status of the iteration. Object exported is of type
235
                javax.servlet.jsp.jstl.core.LoopTagStatus. This scoped variable has nested
236
                visibility.
237
            </description>
238
            <name>varStatus</name>
239
            <required>false</required>
240
            <rtexprvalue>false</rtexprvalue>
241
        </attribute>
242
    </tag>
243
243
244
  <tag>
244
    <tag>
245
    <description>
246
	Iterates over tokens, separated by the supplied delimeters
247
    </description>
248
    <name>forTokens</name>
249
    <tag-class>org.apache.taglibs.standard.tag.rt.core.ForTokensTag</tag-class>
250
    <body-content>JSP</body-content>
251
    <attribute>
252
        <description>
245
        <description>
253
String of tokens to iterate over.
246
            Iterates over tokens, separated by the supplied delimeters
254
        </description>
247
        </description>
255
	<name>items</name>
248
        <name>forTokens</name>
256
	<required>true</required>
249
        <tag-class>org.apache.taglibs.standard.tag.rt.core.ForTokensTag</tag-class>
257
	<rtexprvalue>true</rtexprvalue>
250
        <body-content>JSP</body-content>
258
	<type>java.lang.String</type>
251
        <attribute>
259
    <deferred-value>
252
            <description>
260
	    <type>java.lang.String</type>
253
                String of tokens to iterate over.
261
    </deferred-value>	
254
            </description>
262
    </attribute>
255
            <name>items</name>
263
    <attribute>
256
            <required>true</required>
264
        <description>
257
            <rtexprvalue>true</rtexprvalue>
265
The set of delimiters (the characters that
258
            <type>java.lang.String</type>
266
separate the tokens in the string).
259
            <deferred-value>
267
        </description>
260
                <type>java.lang.String</type>
268
	<name>delims</name>
261
            </deferred-value>
269
	<required>true</required>
262
        </attribute>
270
	<rtexprvalue>true</rtexprvalue>
263
        <attribute>
271
	<type>java.lang.String</type>
264
            <description>
272
    </attribute>
265
                The set of delimiters (the characters that
273
    <attribute>
266
                separate the tokens in the string).
274
        <description>
267
            </description>
275
Iteration begins at the token located at the
268
            <name>delims</name>
276
specified index. First token has index 0.
269
            <required>true</required>
277
        </description>
270
            <rtexprvalue>true</rtexprvalue>
278
	<name>begin</name>
271
            <type>java.lang.String</type>
279
	<required>false</required>
272
        </attribute>
280
	<rtexprvalue>true</rtexprvalue>
273
        <attribute>
281
	<type>int</type>
274
            <description>
282
    </attribute>
275
                Iteration begins at the token located at the
283
    <attribute>
276
                specified index. First token has index 0.
284
        <description>
277
            </description>
285
Iteration ends at the token located at the
278
            <name>begin</name>
286
specified index (inclusive).
279
            <required>false</required>
287
        </description>
280
            <rtexprvalue>true</rtexprvalue>
288
	<name>end</name>
281
            <type>int</type>
289
	<required>false</required>
282
        </attribute>
290
	<rtexprvalue>true</rtexprvalue>
283
        <attribute>
291
	<type>int</type>
284
            <description>
292
    </attribute>
285
                Iteration ends at the token located at the
293
    <attribute>
286
                specified index (inclusive).
294
        <description>
287
            </description>
295
Iteration will only process every step tokens
288
            <name>end</name>
296
of the string, starting with the first one.
289
            <required>false</required>
297
        </description>
290
            <rtexprvalue>true</rtexprvalue>
298
	<name>step</name>
291
            <type>int</type>
299
	<required>false</required>
292
        </attribute>
300
	<rtexprvalue>true</rtexprvalue>
293
        <attribute>
301
	<type>int</type>
294
            <description>
302
    </attribute>
295
                Iteration will only process every step tokens
303
    <attribute>
296
                of the string, starting with the first one.
304
        <description>
297
            </description>
305
Name of the exported scoped variable for the
298
            <name>step</name>
306
current item of the iteration. This scoped
299
            <required>false</required>
307
variable has nested visibility.
300
            <rtexprvalue>true</rtexprvalue>
308
        </description>
301
            <type>int</type>
309
	<name>var</name>
302
        </attribute>
310
	<required>false</required>
303
        <attribute>
311
	<rtexprvalue>false</rtexprvalue>
304
            <description>
312
    </attribute>
305
                Name of the exported scoped variable for the
313
    <attribute>
306
                current item of the iteration. This scoped
314
        <description>
307
                variable has nested visibility.
315
Name of the exported scoped variable for the
308
            </description>
316
status of the iteration. Object exported is of
309
            <name>var</name>
317
type
310
            <required>false</required>
318
javax.servlet.jsp.jstl.core.LoopTag
311
            <rtexprvalue>false</rtexprvalue>
319
Status. This scoped variable has nested
312
        </attribute>
320
visibility.
313
        <attribute>
321
        </description>
314
            <description>
322
	<name>varStatus</name>
315
                Name of the exported scoped variable for the
323
	<required>false</required>
316
                status of the iteration. Object exported is of
324
	<rtexprvalue>false</rtexprvalue>
317
                type
325
    </attribute>
318
                javax.servlet.jsp.jstl.core.LoopTag
326
  </tag>
319
                Status. This scoped variable has nested
320
                visibility.
321
            </description>
322
            <name>varStatus</name>
323
            <required>false</required>
324
            <rtexprvalue>false</rtexprvalue>
325
        </attribute>
326
    </tag>
327
327
328
  <tag>
328
    <tag>
329
    <description>
330
        Like &lt;%= ... &gt;, but for expressions.
331
    </description> 
332
    <name>out</name>
333
    <tag-class>org.apache.taglibs.standard.tag.rt.core.OutTag</tag-class>
334
    <body-content>JSP</body-content>
335
    <attribute>
336
        <description>
329
        <description>
337
Expression to be evaluated.
330
            Like &lt;%= ... &gt;, but for expressions.
338
        </description>
331
        </description>
339
        <name>value</name>
332
        <name>out</name>
340
        <required>true</required>
333
        <tag-class>org.apache.taglibs.standard.tag.rt.core.OutTag</tag-class>
341
        <rtexprvalue>true</rtexprvalue>
334
        <body-content>JSP</body-content>
342
    </attribute>
335
        <attribute>
343
    <attribute>
336
            <description>
344
        <description>
337
                Expression to be evaluated.
345
Default value if the resulting value is null.
338
            </description>
346
        </description>
339
            <name>value</name>
347
        <name>default</name>
340
            <required>true</required>
348
        <required>false</required>
341
            <rtexprvalue>true</rtexprvalue>
349
        <rtexprvalue>true</rtexprvalue>
342
        </attribute>
350
    </attribute>
343
        <attribute>
351
    <attribute>
344
            <description>
352
        <description>
345
                Default value if the resulting value is null.
353
Determines whether characters &lt;,&gt;,&amp;,'," in the
346
            </description>
354
resulting string should be converted to their
347
            <name>default</name>
355
corresponding character entity codes. Default value is
348
            <required>false</required>
356
true.
349
            <rtexprvalue>true</rtexprvalue>
357
        </description>
350
        </attribute>
358
        <name>escapeXml</name>
351
        <attribute>
359
        <required>false</required>
352
            <description>
360
        <rtexprvalue>true</rtexprvalue>
353
                Determines whether characters &lt;,&gt;,&amp;,'," in the
361
    </attribute>
354
                resulting string should be converted to their
362
  </tag>
355
                corresponding character entity codes. Default value is
356
                true.
357
            </description>
358
            <name>escapeXml</name>
359
            <required>false</required>
360
            <rtexprvalue>true</rtexprvalue>
361
        </attribute>
362
    </tag>
363
363
364
364
365
  <tag>
365
    <tag>
366
    <description>
367
        Subtag of &lt;choose&gt; that follows &lt;when&gt; tags
368
        and runs only if all of the prior conditions evaluated to
369
        'false'
370
    </description>
371
    <name>otherwise</name>
372
    <tag-class>org.apache.taglibs.standard.tag.common.core.OtherwiseTag</tag-class>
373
    <body-content>JSP</body-content>
374
  </tag>
375
376
  <tag>
377
    <description>
378
        Adds a parameter to a containing 'import' tag's URL.
379
    </description>
380
    <name>param</name>
381
    <tag-class>org.apache.taglibs.standard.tag.rt.core.ParamTag</tag-class>
382
    <body-content>JSP</body-content>
383
    <attribute>
384
        <description>
366
        <description>
385
Name of the query string parameter.
367
            Subtag of &lt;choose&gt; that follows &lt;when&gt; tags
368
            and runs only if all of the prior conditions evaluated to
369
            'false'
386
        </description>
370
        </description>
387
        <name>name</name>
371
        <name>otherwise</name>
388
        <required>true</required>
372
        <tag-class>org.apache.taglibs.standard.tag.common.core.OtherwiseTag</tag-class>
389
        <rtexprvalue>true</rtexprvalue>
373
        <body-content>JSP</body-content>
390
    </attribute>
374
    </tag>
391
    <attribute>
375
376
    <tag>
392
        <description>
377
        <description>
393
Value of the parameter.
378
            Adds a parameter to a containing 'import' tag's URL.
394
        </description>
379
        </description>
395
        <name>value</name>
380
        <name>param</name>
396
        <required>false</required>
381
        <tag-class>org.apache.taglibs.standard.tag.rt.core.ParamTag</tag-class>
397
        <rtexprvalue>true</rtexprvalue>
382
        <body-content>JSP</body-content>
398
    </attribute>
383
        <attribute>
399
  </tag>
384
            <description>
385
                Name of the query string parameter.
386
            </description>
387
            <name>name</name>
388
            <required>true</required>
389
            <rtexprvalue>true</rtexprvalue>
390
        </attribute>
391
        <attribute>
392
            <description>
393
                Value of the parameter.
394
            </description>
395
            <name>value</name>
396
            <required>false</required>
397
            <rtexprvalue>true</rtexprvalue>
398
        </attribute>
399
    </tag>
400
400
401
  <tag>
401
    <tag>
402
    <description>
403
        Redirects to a new URL.
404
    </description>
405
    <name>redirect</name>
406
    <tag-class>org.apache.taglibs.standard.tag.rt.core.RedirectTag</tag-class>
407
    <body-content>JSP</body-content>
408
    <attribute>
409
        <description>
402
        <description>
410
The URL of the resource to redirect to.
403
            Redirects to a new URL.
411
        </description>
404
        </description>
412
        <name>url</name>
405
        <name>redirect</name>
413
        <required>false</required>
406
        <tag-class>org.apache.taglibs.standard.tag.rt.core.RedirectTag</tag-class>
414
        <rtexprvalue>true</rtexprvalue>
407
        <body-content>JSP</body-content>
415
    </attribute>
408
        <attribute>
416
    <attribute>
409
            <description>
417
        <description>
410
                The URL of the resource to redirect to.
418
Name of the context when redirecting to a relative URL
411
            </description>
419
resource that belongs to a foreign context.
412
            <name>url</name>
420
        </description>
413
            <required>false</required>
421
        <name>context</name>
414
            <rtexprvalue>true</rtexprvalue>
422
        <required>false</required>
415
        </attribute>
423
        <rtexprvalue>true</rtexprvalue>
416
        <attribute>
424
    </attribute>
417
            <description>
425
  </tag>
418
                Name of the context when redirecting to a relative URL
419
                resource that belongs to a foreign context.
420
            </description>
421
            <name>context</name>
422
            <required>false</required>
423
            <rtexprvalue>true</rtexprvalue>
424
        </attribute>
425
    </tag>
426
426
427
  <tag>
427
    <tag>
428
    <description>
429
        Removes a scoped variable (from a particular scope, if specified).
430
    </description>
431
    <name>remove</name>
432
    <tag-class>org.apache.taglibs.standard.tag.common.core.RemoveTag</tag-class>
433
    <body-content>empty</body-content>
434
    <attribute>
435
        <description>
428
        <description>
436
Name of the scoped variable to be removed.
429
            Removes a scoped variable (from a particular scope, if specified).
437
        </description>
430
        </description>
438
        <name>var</name>
431
        <name>remove</name>
439
        <required>true</required>
432
        <tag-class>org.apache.taglibs.standard.tag.common.core.RemoveTag</tag-class>
440
        <rtexprvalue>false</rtexprvalue>
433
        <body-content>empty</body-content>
441
    </attribute>
434
        <attribute>
442
    <attribute>
435
            <description>
443
        <description>
436
                Name of the scoped variable to be removed.
444
Scope for var.
437
            </description>
445
        </description>
438
            <name>var</name>
446
        <name>scope</name>
439
            <required>true</required>
447
        <required>false</required>
440
            <rtexprvalue>false</rtexprvalue>
448
        <rtexprvalue>false</rtexprvalue>
441
        </attribute>
449
    </attribute>
442
        <attribute>
450
  </tag>
443
            <description>
444
                Scope for var.
445
            </description>
446
            <name>scope</name>
447
            <required>false</required>
448
            <rtexprvalue>false</rtexprvalue>
449
        </attribute>
450
    </tag>
451
451
452
 <tag>
452
    <tag>
453
    <description>
454
        Sets the result of an expression evaluation in a 'scope'
455
    </description>
456
    <name>set</name>
457
    <tag-class>org.apache.taglibs.standard.tag.rt.core.SetTag</tag-class>
458
    <body-content>JSP</body-content>
459
    <attribute>
460
        <description>
453
        <description>
461
Name of the exported scoped variable to hold the value
454
            Sets the result of an expression evaluation in a 'scope'
462
specified in the action. The type of the scoped variable is
463
whatever type the value expression evaluates to.
464
        </description>
455
        </description>
465
        <name>var</name>
456
        <name>set</name>
466
        <required>false</required>
457
        <tag-class>org.apache.taglibs.standard.tag.rt.core.SetTag</tag-class>
467
        <rtexprvalue>false</rtexprvalue>
458
        <body-content>JSP</body-content>
468
    </attribute>
459
        <attribute>
469
    <attribute>
460
            <description>
470
        <description>
461
                Name of the exported scoped variable to hold the value
471
Expression to be evaluated.
462
                specified in the action. The type of the scoped variable is
472
        </description>
463
                whatever type the value expression evaluates to.
473
        <name>value</name>
464
            </description>
474
        <required>false</required>
465
            <name>var</name>
475
        <rtexprvalue>true</rtexprvalue>
466
            <required>false</required>
476
        <deferred-value>
467
            <rtexprvalue>false</rtexprvalue>
477
	        <type>java.lang.Object</type>
468
        </attribute>
478
        </deferred-value>
469
        <attribute>
479
    </attribute>
470
            <description>
480
    <attribute>
471
                Expression to be evaluated.
481
        <description>
472
            </description>
482
Target object whose property will be set. Must evaluate to
473
            <name>value</name>
483
a JavaBeans object with setter property property, or to a
474
            <required>false</required>
484
java.util.Map object.
475
            <rtexprvalue>true</rtexprvalue>
485
        </description>
476
            <deferred-value>
486
        <name>target</name>
477
                <type>java.lang.Object</type>
487
        <required>false</required>
478
            </deferred-value>
488
        <rtexprvalue>true</rtexprvalue>
479
        </attribute>
489
    </attribute>
480
        <attribute>
490
    <attribute>
481
            <description>
491
        <description>
482
                Target object whose property will be set. Must evaluate to
492
Name of the property to be set in the target object.
483
                a JavaBeans object with setter property property, or to a
493
        </description>
484
                java.util.Map object.
494
        <name>property</name>
485
            </description>
495
        <required>false</required>
486
            <name>target</name>
496
        <rtexprvalue>true</rtexprvalue>
487
            <required>false</required>
497
    </attribute>
488
            <rtexprvalue>true</rtexprvalue>
498
    <attribute>
489
        </attribute>
499
        <description>
490
        <attribute>
500
Scope for var.
491
            <description>
501
        </description>
492
                Name of the property to be set in the target object.
502
        <name>scope</name>
493
            </description>
503
        <required>false</required>
494
            <name>property</name>
504
        <rtexprvalue>false</rtexprvalue>
495
            <required>false</required>
505
    </attribute>
496
            <rtexprvalue>true</rtexprvalue>
506
  </tag>
497
        </attribute>
498
        <attribute>
499
            <description>
500
                Scope for var.
501
            </description>
502
            <name>scope</name>
503
            <required>false</required>
504
            <rtexprvalue>false</rtexprvalue>
505
        </attribute>
506
    </tag>
507
507
508
  <tag>
508
    <tag>
509
    <description>
510
        Creates a URL with optional query parameters.
511
    </description>
512
    <name>url</name>
513
    <tag-class>org.apache.taglibs.standard.tag.rt.core.UrlTag</tag-class>
514
    <body-content>JSP</body-content>
515
    <attribute>
516
        <description>
509
        <description>
517
Name of the exported scoped variable for the
510
            Creates a URL with optional query parameters.
518
processed url. The type of the scoped variable is
519
String.
520
        </description>
511
        </description>
521
        <name>var</name>
512
        <name>url</name>
522
        <required>false</required>
513
        <tag-class>org.apache.taglibs.standard.tag.rt.core.UrlTag</tag-class>
523
        <rtexprvalue>false</rtexprvalue>
514
        <body-content>JSP</body-content>
524
    </attribute>
515
        <attribute>
525
    <attribute>
516
            <description>
526
        <description>
517
                Name of the exported scoped variable for the
527
Scope for var.
518
                processed url. The type of the scoped variable is
528
        </description>
519
                String.
529
        <name>scope</name>
520
            </description>
530
        <required>false</required>
521
            <name>var</name>
531
        <rtexprvalue>false</rtexprvalue>
522
            <required>false</required>
532
    </attribute>
523
            <rtexprvalue>false</rtexprvalue>
533
    <attribute>
524
        </attribute>
534
        <description>
525
        <attribute>
535
URL to be processed.
526
            <description>
536
        </description>
527
                Scope for var.
537
        <name>value</name>
528
            </description>
538
        <required>false</required>
529
            <name>scope</name>
539
        <rtexprvalue>true</rtexprvalue>
530
            <required>false</required>
540
    </attribute>
531
            <rtexprvalue>false</rtexprvalue>
541
    <attribute>
532
        </attribute>
542
        <description>
533
        <attribute>
543
Name of the context when specifying a relative URL
534
            <description>
544
resource that belongs to a foreign context.
535
                URL to be processed.
545
        </description>
536
            </description>
546
        <name>context</name>
537
            <name>value</name>
547
        <required>false</required>
538
            <required>false</required>
548
        <rtexprvalue>true</rtexprvalue>
539
            <rtexprvalue>true</rtexprvalue>
549
    </attribute>
540
        </attribute>
550
  </tag>
541
        <attribute>
542
            <description>
543
                Name of the context when specifying a relative URL
544
                resource that belongs to a foreign context.
545
            </description>
546
            <name>context</name>
547
            <required>false</required>
548
            <rtexprvalue>true</rtexprvalue>
549
        </attribute>
550
    </tag>
551
551
552
  <tag>
552
    <tag>
553
    <description>
554
	Subtag of &lt;choose&gt; that includes its body if its
555
	condition evalutes to 'true'
556
    </description>
557
    <name>when</name>
558
    <tag-class>org.apache.taglibs.standard.tag.rt.core.WhenTag</tag-class>
559
    <body-content>JSP</body-content>
560
    <attribute>
561
        <description>
553
        <description>
562
The test condition that determines whether or not the
554
            Subtag of &lt;choose&gt; that includes its body if its
563
body content should be processed.
555
            condition evalutes to 'true'
564
        </description>
556
        </description>
565
        <name>test</name>
557
        <name>when</name>
566
        <required>true</required>
558
        <tag-class>org.apache.taglibs.standard.tag.rt.core.WhenTag</tag-class>
567
        <rtexprvalue>true</rtexprvalue>
559
        <body-content>JSP</body-content>
568
	<type>boolean</type>
560
        <attribute>
569
    </attribute>
561
            <description>
570
  </tag>
562
                The test condition that determines whether or not the
563
                body content should be processed.
564
            </description>
565
            <name>test</name>
566
            <required>true</required>
567
            <rtexprvalue>true</rtexprvalue>
568
            <type>boolean</type>
569
        </attribute>
570
    </tag>
571
571
572
</taglib>
572
</taglib>
(-)src/main/resources/META-INF/fn.tld (-186 / +187 lines)
Lines 1-207 Link Here
1
<?xml version="1.0" encoding="UTF-8" ?>
1
<?xml version="1.0" encoding="UTF-8" ?>
2
2
3
<taglib xmlns="http://java.sun.com/xml/ns/j2ee"
3
<taglib xmlns="http://java.sun.com/xml/ns/j2ee"
4
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5
  xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
5
        xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
6
  version="2.0">
6
        version="2.0">
7
    
8
  <description>JSTL 1.1 functions library</description>
9
  <display-name>JSTL functions</display-name>
10
  <tlib-version>1.1</tlib-version>
11
  <short-name>fn</short-name>
12
  <uri>http://java.sun.com/jsp/jstl/functions</uri>
13
7
14
  <function>
8
    <description>JSTL 1.1 functions library</description>
15
    <description>
9
    <display-name>JSTL functions</display-name>
16
      Tests if an input string contains the specified substring.
10
    <tlib-version>1.1</tlib-version>
17
    </description>
11
    <short-name>fn</short-name>
18
    <name>contains</name>
12
    <uri>http://java.sun.com/jsp/jstl/functions</uri>
19
    <function-class>org.apache.taglibs.standard.functions.Functions</function-class>
20
    <function-signature>boolean contains(java.lang.String, java.lang.String)</function-signature>
21
    <example>
22
      &lt;c:if test="${fn:contains(name, searchString)}">
23
    </example>
24
  </function>
25
13
26
  <function>
14
    <function>
27
    <description>
15
        <description>
28
      Tests if an input string contains the specified substring in a case insensitive way.
16
            Tests if an input string contains the specified substring.
29
    </description>
17
        </description>
30
    <name>containsIgnoreCase</name>
18
        <name>contains</name>
31
    <function-class>org.apache.taglibs.standard.functions.Functions</function-class>
19
        <function-class>org.apache.taglibs.standard.functions.Functions</function-class>
32
    <function-signature>boolean containsIgnoreCase(java.lang.String, java.lang.String)</function-signature>
20
        <function-signature>boolean contains(java.lang.String, java.lang.String)</function-signature>
33
    <example>
21
        <example>
34
      &lt;c:if test="${fn:containsIgnoreCase(name, searchString)}">
22
            &lt;c:if test="${fn:contains(name, searchString)}">
35
    </example>
23
        </example>
36
  </function>
24
    </function>
37
25
38
  <function>
26
    <function>
39
    <description>
27
        <description>
40
      Tests if an input string ends with the specified suffix.
28
            Tests if an input string contains the specified substring in a case insensitive way.
41
    </description>
29
        </description>
42
    <name>endsWith</name>
30
        <name>containsIgnoreCase</name>
43
    <function-class>org.apache.taglibs.standard.functions.Functions</function-class>
31
        <function-class>org.apache.taglibs.standard.functions.Functions</function-class>
44
    <function-signature>boolean endsWith(java.lang.String, java.lang.String)</function-signature>
32
        <function-signature>boolean containsIgnoreCase(java.lang.String, java.lang.String)</function-signature>
45
    <example>
33
        <example>
46
      &lt;c:if test="${fn:endsWith(filename, ".txt")}">
34
            &lt;c:if test="${fn:containsIgnoreCase(name, searchString)}">
47
    </example>
35
        </example>
48
  </function>
36
    </function>
49
37
50
  <function>
38
    <function>
51
    <description>
39
        <description>
52
      Escapes characters that could be interpreted as XML markup.
40
            Tests if an input string ends with the specified suffix.
53
    </description>
41
        </description>
54
    <name>escapeXml</name>
42
        <name>endsWith</name>
55
    <function-class>org.apache.taglibs.standard.functions.Functions</function-class>
43
        <function-class>org.apache.taglibs.standard.functions.Functions</function-class>
56
    <function-signature>java.lang.String escapeXml(java.lang.String)</function-signature>
44
        <function-signature>boolean endsWith(java.lang.String, java.lang.String)</function-signature>
57
    <example>
45
        <example>
58
      ${fn:escapeXml(param:info)}
46
            &lt;c:if test="${fn:endsWith(filename, ".txt")}">
59
    </example>
47
        </example>
60
  </function>
48
    </function>
61
49
62
  <function>
50
    <function>
63
    <description>
51
        <description>
64
      Returns the index withing a string of the first occurrence of a specified substring.
52
            Escapes characters that could be interpreted as XML markup.
65
    </description>
53
        </description>
66
    <name>indexOf</name>
54
        <name>escapeXml</name>
67
    <function-class>org.apache.taglibs.standard.functions.Functions</function-class>
55
        <function-class>org.apache.taglibs.standard.functions.Functions</function-class>
68
    <function-signature>int indexOf(java.lang.String, java.lang.String)</function-signature>
56
        <function-signature>java.lang.String escapeXml(java.lang.String)</function-signature>
69
    <example>
57
        <example>
70
      ${fn:indexOf(name, "-")}
58
            ${fn:escapeXml(param:info)}
71
    </example>
59
        </example>
72
  </function>
60
    </function>
73
61
74
  <function>
62
    <function>
75
    <description>
63
        <description>
76
      Joins all elements of an array into a string.
64
            Returns the index withing a string of the first occurrence of a specified substring.
77
    </description>
65
        </description>
78
    <name>join</name>
66
        <name>indexOf</name>
79
    <function-class>org.apache.taglibs.standard.functions.Functions</function-class>
67
        <function-class>org.apache.taglibs.standard.functions.Functions</function-class>
80
    <function-signature>java.lang.String join(java.lang.String[], java.lang.String)</function-signature>
68
        <function-signature>int indexOf(java.lang.String, java.lang.String)</function-signature>
81
    <example>
69
        <example>
82
      ${fn:join(array, ";")}
70
            ${fn:indexOf(name, "-")}
83
    </example>
71
        </example>
84
  </function>
72
    </function>
85
73
86
  <function>
74
    <function>
87
    <description>
75
        <description>
88
      Returns the number of items in a collection, or the number of characters in a string.
76
            Joins all elements of an array into a string.
89
    </description>
77
        </description>
90
    <name>length</name>
78
        <name>join</name>
91
    <function-class>org.apache.taglibs.standard.functions.Functions</function-class>
79
        <function-class>org.apache.taglibs.standard.functions.Functions</function-class>
92
    <function-signature>int length(java.lang.Object)</function-signature>
80
        <function-signature>java.lang.String join(java.lang.String[], java.lang.String)</function-signature>
93
    <example>
81
        <example>
94
      You have ${fn:length(shoppingCart.products)} in your shopping cart.
82
            ${fn:join(array, ";")}
95
    </example>
83
        </example>
96
  </function>
84
    </function>
97
85
98
  <function>
86
    <function>
99
    <description>
87
        <description>
100
      Returns a string resulting from replacing in an input string all occurrences
88
            Returns the number of items in a collection, or the number of characters in a string.
101
      of a "before" string into an "after" substring.
89
        </description>
102
    </description>
90
        <name>length</name>
103
    <name>replace</name>
91
        <function-class>org.apache.taglibs.standard.functions.Functions</function-class>
104
    <function-class>org.apache.taglibs.standard.functions.Functions</function-class>
92
        <function-signature>int length(java.lang.Object)</function-signature>
105
    <function-signature>java.lang.String replace(java.lang.String, java.lang.String, java.lang.String)</function-signature>
93
        <example>
106
    <example>
94
            You have ${fn:length(shoppingCart.products)} in your shopping cart.
107
      ${fn:replace(text, "-", "&#149;")}
95
        </example>
108
    </example>
96
    </function>
109
  </function>
110
97
111
  <function>
98
    <function>
112
    <description>
99
        <description>
113
      Splits a string into an array of substrings.
100
            Returns a string resulting from replacing in an input string all occurrences
114
    </description>
101
            of a "before" string into an "after" substring.
115
    <name>split</name>
102
        </description>
116
    <function-class>org.apache.taglibs.standard.functions.Functions</function-class>
103
        <name>replace</name>
117
    <function-signature>java.lang.String[] split(java.lang.String, java.lang.String)</function-signature>
104
        <function-class>org.apache.taglibs.standard.functions.Functions</function-class>
118
    <example>
105
        <function-signature>java.lang.String replace(java.lang.String, java.lang.String, java.lang.String)
119
      ${fn:split(customerNames, ";")}
106
        </function-signature>
120
    </example>
107
        <example>
121
  </function>
108
            ${fn:replace(text, "-", "&#149;")}
109
        </example>
110
    </function>
122
111
123
  <function>
112
    <function>
124
    <description>
113
        <description>
125
      Tests if an input string starts with the specified prefix.
114
            Splits a string into an array of substrings.
126
    </description>
115
        </description>
127
    <name>startsWith</name>
116
        <name>split</name>
128
    <function-class>org.apache.taglibs.standard.functions.Functions</function-class>
117
        <function-class>org.apache.taglibs.standard.functions.Functions</function-class>
129
    <function-signature>boolean startsWith(java.lang.String, java.lang.String)</function-signature>
118
        <function-signature>java.lang.String[] split(java.lang.String, java.lang.String)</function-signature>
130
    <example>
119
        <example>
131
      &lt;c:if test="${fn:startsWith(product.id, "100-")}">
120
            ${fn:split(customerNames, ";")}
132
    </example>
121
        </example>
133
  </function>
122
    </function>
134
123
135
  <function>
124
    <function>
136
    <description>
125
        <description>
137
      Returns a subset of a string.
126
            Tests if an input string starts with the specified prefix.
138
    </description>
127
        </description>
139
    <name>substring</name>
128
        <name>startsWith</name>
140
    <function-class>org.apache.taglibs.standard.functions.Functions</function-class>
129
        <function-class>org.apache.taglibs.standard.functions.Functions</function-class>
141
    <function-signature>java.lang.String substring(java.lang.String, int, int)</function-signature>
130
        <function-signature>boolean startsWith(java.lang.String, java.lang.String)</function-signature>
142
    <example>
131
        <example>
143
      P.O. Box: ${fn:substring(zip, 6, -1)}
132
            &lt;c:if test="${fn:startsWith(product.id, "100-")}">
144
    </example>
133
        </example>
145
  </function>
134
    </function>
146
135
147
  <function>
136
    <function>
148
    <description>
137
        <description>
149
      Returns a subset of a string following a specific substring.
138
            Returns a subset of a string.
150
    </description>
139
        </description>
151
    <name>substringAfter</name>
140
        <name>substring</name>
152
    <function-class>org.apache.taglibs.standard.functions.Functions</function-class>
141
        <function-class>org.apache.taglibs.standard.functions.Functions</function-class>
153
    <function-signature>java.lang.String substringAfter(java.lang.String, java.lang.String)</function-signature>
142
        <function-signature>java.lang.String substring(java.lang.String, int, int)</function-signature>
154
    <example>
143
        <example>
155
      P.O. Box: ${fn:substringAfter(zip, "-")}
144
            P.O. Box: ${fn:substring(zip, 6, -1)}
156
    </example>
145
        </example>
157
  </function>
146
    </function>
158
147
159
  <function>
148
    <function>
160
    <description>
149
        <description>
161
      Returns a subset of a string before a specific substring.
150
            Returns a subset of a string following a specific substring.
162
    </description>
151
        </description>
163
    <name>substringBefore</name>
152
        <name>substringAfter</name>
164
    <function-class>org.apache.taglibs.standard.functions.Functions</function-class>
153
        <function-class>org.apache.taglibs.standard.functions.Functions</function-class>
165
    <function-signature>java.lang.String substringBefore(java.lang.String, java.lang.String)</function-signature>
154
        <function-signature>java.lang.String substringAfter(java.lang.String, java.lang.String)</function-signature>
166
    <example>
155
        <example>
167
      Zip (without P.O. Box): ${fn:substringBefore(zip, "-")}
156
            P.O. Box: ${fn:substringAfter(zip, "-")}
168
    </example>
157
        </example>
169
  </function>
158
    </function>
170
159
171
  <function>
160
    <function>
172
    <description>
161
        <description>
173
      Converts all of the characters of a string to lower case.
162
            Returns a subset of a string before a specific substring.
174
    </description>
163
        </description>
175
    <name>toLowerCase</name>
164
        <name>substringBefore</name>
176
    <function-class>org.apache.taglibs.standard.functions.Functions</function-class>
165
        <function-class>org.apache.taglibs.standard.functions.Functions</function-class>
177
    <function-signature>java.lang.String toLowerCase(java.lang.String)</function-signature>
166
        <function-signature>java.lang.String substringBefore(java.lang.String, java.lang.String)</function-signature>
178
    <example>
167
        <example>
179
      Product name: ${fn.toLowerCase(product.name)}
168
            Zip (without P.O. Box): ${fn:substringBefore(zip, "-")}
180
    </example>
169
        </example>
181
  </function>
170
    </function>
182
171
183
  <function>
172
    <function>
184
    <description>
173
        <description>
185
      Converts all of the characters of a string to upper case.
174
            Converts all of the characters of a string to lower case.
186
    </description>
175
        </description>
187
    <name>toUpperCase</name>
176
        <name>toLowerCase</name>
188
    <function-class>org.apache.taglibs.standard.functions.Functions</function-class>
177
        <function-class>org.apache.taglibs.standard.functions.Functions</function-class>
189
    <function-signature>java.lang.String toUpperCase(java.lang.String)</function-signature>
178
        <function-signature>java.lang.String toLowerCase(java.lang.String)</function-signature>
190
    <example>
179
        <example>
191
      Product name: ${fn.UpperCase(product.name)}
180
            Product name: ${fn.toLowerCase(product.name)}
192
    </example>
181
        </example>
193
  </function>
182
    </function>
194
183
195
  <function>
184
    <function>
196
    <description>
185
        <description>
197
      Removes white spaces from both ends of a string.
186
            Converts all of the characters of a string to upper case.
198
    </description>
187
        </description>
199
    <name>trim</name>
188
        <name>toUpperCase</name>
200
    <function-class>org.apache.taglibs.standard.functions.Functions</function-class>
189
        <function-class>org.apache.taglibs.standard.functions.Functions</function-class>
201
    <function-signature>java.lang.String trim(java.lang.String)</function-signature>
190
        <function-signature>java.lang.String toUpperCase(java.lang.String)</function-signature>
202
    <example>
191
        <example>
203
      Name: ${fn.trim(name)}
192
            Product name: ${fn.UpperCase(product.name)}
204
    </example>  
193
        </example>
205
  </function>
194
    </function>
206
195
196
    <function>
197
        <description>
198
            Removes white spaces from both ends of a string.
199
        </description>
200
        <name>trim</name>
201
        <function-class>org.apache.taglibs.standard.functions.Functions</function-class>
202
        <function-signature>java.lang.String trim(java.lang.String)</function-signature>
203
        <example>
204
            Name: ${fn.trim(name)}
205
        </example>
206
    </function>
207
207
</taglib>
208
</taglib>
(-)src/main/resources/META-INF/permittedTaglibs.tld (-29 / +29 lines)
Lines 1-34 Link Here
1
<?xml version="1.0" encoding="UTF-8" ?>
1
<?xml version="1.0" encoding="UTF-8" ?>
2
2
3
<taglib xmlns="http://java.sun.com/xml/ns/j2ee"
3
<taglib xmlns="http://java.sun.com/xml/ns/j2ee"
4
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
5
        xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
6
    version="2.0">
6
        version="2.0">
7
  <description>
7
    <description>
8
    Restricts JSP pages to the JSTL tag libraries
8
        Restricts JSP pages to the JSTL tag libraries
9
  </description>    
9
    </description>
10
  <display-name>permittedTaglibs</display-name>
10
    <display-name>permittedTaglibs</display-name>
11
  <tlib-version>1.1</tlib-version>
11
    <tlib-version>1.1</tlib-version>
12
  <short-name>permittedTaglibs</short-name>
12
    <short-name>permittedTaglibs</short-name>
13
  <uri>http://jakarta.apache.org/taglibs/standard/permittedTaglibs</uri>
13
    <uri>http://jakarta.apache.org/taglibs/standard/permittedTaglibs</uri>
14
14
15
  <validator>
15
    <validator>
16
    <validator-class>
16
        <validator-class>
17
	javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV
17
            javax.servlet.jsp.jstl.tlv.PermittedTaglibsTLV
18
    </validator-class>        
18
        </validator-class>
19
    <init-param>
19
        <init-param>
20
      <description>
20
            <description>
21
        Whitespace-separated list of taglib URIs to permit.  This example
21
                Whitespace-separated list of taglib URIs to permit. This example
22
	TLD for the Standard Taglib allows only JSTL 'el' taglibs to be
22
                TLD for the Standard Taglib allows only JSTL 'el' taglibs to be
23
	imported.
23
                imported.
24
      </description>        
24
            </description>
25
      <param-name>permittedTaglibs</param-name>
25
            <param-name>permittedTaglibs</param-name>
26
      <param-value>
26
            <param-value>
27
	http://java.sun.com/jsp/jstl/core
27
                http://java.sun.com/jsp/jstl/core
28
	http://java.sun.com/jsp/jstl/fmt
28
                http://java.sun.com/jsp/jstl/fmt
29
	http://java.sun.com/jsp/jstl/sql
29
                http://java.sun.com/jsp/jstl/sql
30
	http://java.sun.com/jsp/jstl/xml
30
                http://java.sun.com/jsp/jstl/xml
31
      </param-value>
31
            </param-value>
32
    </init-param>
32
        </init-param>
33
  </validator>
33
    </validator>
34
</taglib>
34
</taglib>
(-)src/main/resources/META-INF/scriptfree.tld (-45 / +45 lines)
Lines 1-51 Link Here
1
<?xml version="1.0" encoding="UTF-8" ?>
1
<?xml version="1.0" encoding="UTF-8" ?>
2
2
3
<taglib xmlns="http://java.sun.com/xml/ns/j2ee"
3
<taglib xmlns="http://java.sun.com/xml/ns/j2ee"
4
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
5
        xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
6
    version="2.0">
6
        version="2.0">
7
  <description>
8
    Validates JSP pages to prohibit use of scripting elements.
9
  </description>
10
  <tlib-version>1.1</tlib-version>
11
  <short-name>scriptfree</short-name>
12
  <uri>http://jakarta.apache.org/taglibs/standard/scriptfree</uri>
13
14
  <validator>
15
    <description>
7
    <description>
16
      Validates prohibitions against scripting elements.
8
        Validates JSP pages to prohibit use of scripting elements.
17
    </description>
9
    </description>
18
    <validator-class>
10
    <tlib-version>1.1</tlib-version>
19
    javax.servlet.jsp.jstl.tlv.ScriptFreeTLV
11
    <short-name>scriptfree</short-name>
20
    </validator-class>
12
    <uri>http://jakarta.apache.org/taglibs/standard/scriptfree</uri>
21
    <init-param>
13
22
      <description>
14
    <validator>
23
        Controls whether or not declarations are considered valid.
15
        <description>
24
      </description>
16
            Validates prohibitions against scripting elements.
25
      <param-name>allowDeclarations</param-name>
17
        </description>
26
      <param-value>false</param-value>
18
        <validator-class>
27
    </init-param>
19
            javax.servlet.jsp.jstl.tlv.ScriptFreeTLV
28
    <init-param>
20
        </validator-class>
29
      <description>
21
        <init-param>
30
        Controls whether or not scriptlets are considered valid.
22
            <description>
31
      </description>
23
                Controls whether or not declarations are considered valid.
32
      <param-name>allowScriptlets</param-name>
24
            </description>
33
      <param-value>false</param-value>
25
            <param-name>allowDeclarations</param-name>
34
    </init-param>
26
            <param-value>false</param-value>
35
    <init-param>
27
        </init-param>
36
      <description>
28
        <init-param>
37
        Controls whether or not top-level expressions are considered valid.
29
            <description>
38
      </description>
30
                Controls whether or not scriptlets are considered valid.
39
      <param-name>allowExpressions</param-name>
31
            </description>
40
      <param-value>false</param-value>
32
            <param-name>allowScriptlets</param-name>
41
    </init-param>
33
            <param-value>false</param-value>
42
    <init-param>
34
        </init-param>
43
      <description>
35
        <init-param>
44
        Controls whether or not expressions used to supply request-time
36
            <description>
45
        attribute values are considered valid.
37
                Controls whether or not top-level expressions are considered valid.
46
      </description>
38
            </description>
47
      <param-name>allowRTExpressions</param-name>
39
            <param-name>allowExpressions</param-name>
48
      <param-value>false</param-value>
40
            <param-value>false</param-value>
49
    </init-param>
41
        </init-param>
50
  </validator>
42
        <init-param>
43
            <description>
44
                Controls whether or not expressions used to supply request-time
45
                attribute values are considered valid.
46
            </description>
47
            <param-name>allowRTExpressions</param-name>
48
            <param-value>false</param-value>
49
        </init-param>
50
    </validator>
51
</taglib>
51
</taglib>
(-)src/main/resources/META-INF/fmt.tld (-627 / +627 lines)
Lines 1-671 Link Here
1
<?xml version="1.0" encoding="UTF-8" ?>
1
<?xml version="1.0" encoding="UTF-8" ?>
2
2
3
<taglib xmlns="http://java.sun.com/xml/ns/j2ee"
3
<taglib xmlns="http://java.sun.com/xml/ns/j2ee"
4
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
5
        xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
6
    version="2.0">
6
        version="2.0">
7
    
8
  <description>JSTL 1.1 i18n-capable formatting library</description>
9
  <display-name>JSTL fmt</display-name>
10
  <tlib-version>1.1</tlib-version>
11
  <short-name>fmt</short-name>
12
  <uri>http://java.sun.com/jsp/jstl/fmt</uri>
13
7
14
  <validator>
8
    <description>JSTL 1.1 i18n-capable formatting library</description>
15
    <description>
9
    <display-name>JSTL fmt</display-name>
16
        Provides core validation features for JSTL tags.
10
    <tlib-version>1.1</tlib-version>
17
    </description>
11
    <short-name>fmt</short-name>
18
    <validator-class>
12
    <uri>http://java.sun.com/jsp/jstl/fmt</uri>
19
        org.apache.taglibs.standard.tlv.JstlFmtTLV
20
    </validator-class>
21
  </validator>
22
13
23
  <tag>
14
    <validator>
24
    <description>
25
        Sets the request character encoding
26
    </description>
27
    <name>requestEncoding</name>
28
    <tag-class>org.apache.taglibs.standard.tag.rt.fmt.RequestEncodingTag</tag-class>
29
    <body-content>empty</body-content>
30
    <attribute>
31
        <description>
15
        <description>
32
Name of character encoding to be applied when
16
            Provides core validation features for JSTL tags.
33
decoding request parameters.
34
        </description>
17
        </description>
35
        <name>value</name>
18
        <validator-class>
36
        <required>false</required>
19
            org.apache.taglibs.standard.tlv.JstlFmtTLV
37
        <rtexprvalue>true</rtexprvalue>
20
        </validator-class>
38
    </attribute>
21
    </validator>
39
  </tag>
40
22
41
  <tag>
23
    <tag>
42
    <description>
43
        Stores the given locale in the locale configuration variable
44
    </description>
45
    <name>setLocale</name>
46
    <tag-class>org.apache.taglibs.standard.tag.rt.fmt.SetLocaleTag</tag-class>
47
    <body-content>empty</body-content>
48
    <attribute>
49
        <description>
24
        <description>
50
A String value is interpreted as the
25
            Sets the request character encoding
51
printable representation of a locale, which
52
must contain a two-letter (lower-case)
53
language code (as defined by ISO-639),
54
and may contain a two-letter (upper-case)
55
country code (as defined by ISO-3166).
56
Language and country codes must be
57
separated by hyphen (-) or underscore
58
(_).        
59
	</description>
60
        <name>value</name>
61
        <required>true</required>
62
        <rtexprvalue>true</rtexprvalue>
63
    </attribute>
64
    <attribute>
65
        <description>
66
Vendor- or browser-specific variant.
67
See the java.util.Locale javadocs for
68
more information on variants.
69
        </description>
26
        </description>
70
        <name>variant</name>
27
        <name>requestEncoding</name>
71
        <required>false</required>
28
        <tag-class>org.apache.taglibs.standard.tag.rt.fmt.RequestEncodingTag</tag-class>
72
        <rtexprvalue>true</rtexprvalue>
29
        <body-content>empty</body-content>
73
    </attribute>
30
        <attribute>
74
    <attribute>
31
            <description>
32
                Name of character encoding to be applied when
33
                decoding request parameters.
34
            </description>
35
            <name>value</name>
36
            <required>false</required>
37
            <rtexprvalue>true</rtexprvalue>
38
        </attribute>
39
    </tag>
40
41
    <tag>
75
        <description>
42
        <description>
76
Scope of the locale configuration variable.
43
            Stores the given locale in the locale configuration variable
77
        </description>
44
        </description>
78
        <name>scope</name>
45
        <name>setLocale</name>
79
        <required>false</required>
46
        <tag-class>org.apache.taglibs.standard.tag.rt.fmt.SetLocaleTag</tag-class>
80
        <rtexprvalue>false</rtexprvalue>
47
        <body-content>empty</body-content>
81
    </attribute>
48
        <attribute>
82
  </tag>
49
            <description>
50
                A String value is interpreted as the
51
                printable representation of a locale, which
52
                must contain a two-letter (lower-case)
53
                language code (as defined by ISO-639),
54
                and may contain a two-letter (upper-case)
55
                country code (as defined by ISO-3166).
56
                Language and country codes must be
57
                separated by hyphen (-) or underscore
58
                (_).
59
            </description>
60
            <name>value</name>
61
            <required>true</required>
62
            <rtexprvalue>true</rtexprvalue>
63
        </attribute>
64
        <attribute>
65
            <description>
66
                Vendor- or browser-specific variant.
67
                See the java.util.Locale javadocs for
68
                more information on variants.
69
            </description>
70
            <name>variant</name>
71
            <required>false</required>
72
            <rtexprvalue>true</rtexprvalue>
73
        </attribute>
74
        <attribute>
75
            <description>
76
                Scope of the locale configuration variable.
77
            </description>
78
            <name>scope</name>
79
            <required>false</required>
80
            <rtexprvalue>false</rtexprvalue>
81
        </attribute>
82
    </tag>
83
83
84
  <tag>
84
    <tag>
85
    <description>
86
        Specifies the time zone for any time formatting or parsing actions
87
        nested in its body
88
    </description>
89
    <name>timeZone</name>
90
    <tag-class>org.apache.taglibs.standard.tag.rt.fmt.TimeZoneTag</tag-class>
91
    <body-content>JSP</body-content>
92
    <attribute>
93
        <description>
85
        <description>
94
The time zone. A String value is interpreted as
86
            Specifies the time zone for any time formatting or parsing actions
95
a time zone ID. This may be one of the time zone
87
            nested in its body
96
IDs supported by the Java platform (such as
97
"America/Los_Angeles") or a custom time zone
98
ID (such as "GMT-8"). See
99
java.util.TimeZone for more information on
100
supported time zone formats.
101
        </description>
88
        </description>
102
        <name>value</name>
89
        <name>timeZone</name>
103
        <required>true</required>
90
        <tag-class>org.apache.taglibs.standard.tag.rt.fmt.TimeZoneTag</tag-class>
104
        <rtexprvalue>true</rtexprvalue>
91
        <body-content>JSP</body-content>
105
    </attribute>
92
        <attribute>
106
  </tag>
93
            <description>
94
                The time zone. A String value is interpreted as
95
                a time zone ID. This may be one of the time zone
96
                IDs supported by the Java platform (such as
97
                "America/Los_Angeles") or a custom time zone
98
                ID (such as "GMT-8"). See
99
                java.util.TimeZone for more information on
100
                supported time zone formats.
101
            </description>
102
            <name>value</name>
103
            <required>true</required>
104
            <rtexprvalue>true</rtexprvalue>
105
        </attribute>
106
    </tag>
107
107
108
  <tag>
108
    <tag>
109
    <description>
110
        Stores the given time zone in the time zone configuration variable
111
    </description>
112
    <name>setTimeZone</name>
113
    <tag-class>org.apache.taglibs.standard.tag.rt.fmt.SetTimeZoneTag</tag-class>
114
    <body-content>empty</body-content>
115
    <attribute>
116
        <description>
109
        <description>
117
The time zone. A String value is interpreted as
110
            Stores the given time zone in the time zone configuration variable
118
a time zone ID. This may be one of the time zone
119
IDs supported by the Java platform (such as
120
"America/Los_Angeles") or a custom time zone
121
ID (such as "GMT-8"). See java.util.TimeZone for
122
more information on supported time zone
123
formats.
124
        </description>
111
        </description>
125
        <name>value</name>
112
        <name>setTimeZone</name>
126
        <required>true</required>
113
        <tag-class>org.apache.taglibs.standard.tag.rt.fmt.SetTimeZoneTag</tag-class>
127
        <rtexprvalue>true</rtexprvalue>
114
        <body-content>empty</body-content>
128
    </attribute>
115
        <attribute>
129
    <attribute>
116
            <description>
130
        <description>
117
                The time zone. A String value is interpreted as
131
Name of the exported scoped variable which
118
                a time zone ID. This may be one of the time zone
132
stores the time zone of type
119
                IDs supported by the Java platform (such as
133
java.util.TimeZone.
120
                "America/Los_Angeles") or a custom time zone
134
        </description>
121
                ID (such as "GMT-8"). See java.util.TimeZone for
135
        <name>var</name>
122
                more information on supported time zone
136
        <required>false</required>
123
                formats.
137
        <rtexprvalue>false</rtexprvalue>
124
            </description>
138
    </attribute>
125
            <name>value</name>
139
    <attribute>
126
            <required>true</required>
140
        <description>
127
            <rtexprvalue>true</rtexprvalue>
141
Scope of var or the time zone configuration
128
        </attribute>
142
variable.
129
        <attribute>
143
        </description>
130
            <description>
144
        <name>scope</name>
131
                Name of the exported scoped variable which
145
        <required>false</required>
132
                stores the time zone of type
146
        <rtexprvalue>false</rtexprvalue>
133
                java.util.TimeZone.
147
    </attribute>
134
            </description>
148
  </tag>
135
            <name>var</name>
136
            <required>false</required>
137
            <rtexprvalue>false</rtexprvalue>
138
        </attribute>
139
        <attribute>
140
            <description>
141
                Scope of var or the time zone configuration
142
                variable.
143
            </description>
144
            <name>scope</name>
145
            <required>false</required>
146
            <rtexprvalue>false</rtexprvalue>
147
        </attribute>
148
    </tag>
149
149
150
  <tag>
150
    <tag>
151
    <description>
152
        Loads a resource bundle to be used by its tag body
153
    </description>
154
    <name>bundle</name>
155
    <tag-class>org.apache.taglibs.standard.tag.rt.fmt.BundleTag</tag-class>
156
    <body-content>JSP</body-content>
157
    <attribute>
158
        <description>
151
        <description>
159
Resource bundle base name. This is the bundle's
152
            Loads a resource bundle to be used by its tag body
160
fully-qualified resource name, which has the same
161
form as a fully-qualified class name, that is, it uses
162
"." as the package component separator and does not
163
have any file type (such as ".class" or ".properties")
164
suffix.
165
        </description>
153
        </description>
166
        <name>basename</name>
154
        <name>bundle</name>
167
        <required>true</required>
155
        <tag-class>org.apache.taglibs.standard.tag.rt.fmt.BundleTag</tag-class>
168
        <rtexprvalue>true</rtexprvalue>
156
        <body-content>JSP</body-content>
169
    </attribute>
157
        <attribute>
170
    <attribute>
158
            <description>
171
        <description>
159
                Resource bundle base name. This is the bundle's
172
Prefix to be prepended to the value of the message
160
                fully-qualified resource name, which has the same
173
key of any nested &lt;fmt:message&gt; action.
161
                form as a fully-qualified class name, that is, it uses
174
        </description>
162
                "." as the package component separator and does not
175
        <name>prefix</name>
163
                have any file type (such as ".class" or ".properties")
176
        <required>false</required>
164
                suffix.
177
        <rtexprvalue>true</rtexprvalue>
165
            </description>
178
    </attribute>
166
            <name>basename</name>
179
  </tag>
167
            <required>true</required>
168
            <rtexprvalue>true</rtexprvalue>
169
        </attribute>
170
        <attribute>
171
            <description>
172
                Prefix to be prepended to the value of the message
173
                key of any nested &lt;fmt:message&gt; action.
174
            </description>
175
            <name>prefix</name>
176
            <required>false</required>
177
            <rtexprvalue>true</rtexprvalue>
178
        </attribute>
179
    </tag>
180
180
181
  <tag>
181
    <tag>
182
    <description>
183
        Loads a resource bundle and stores it in the named scoped variable or
184
        the bundle configuration variable
185
    </description>
186
    <name>setBundle</name>
187
    <tag-class>org.apache.taglibs.standard.tag.rt.fmt.SetBundleTag</tag-class>
188
    <body-content>empty</body-content>
189
    <attribute>
190
        <description>
182
        <description>
191
Resource bundle base name. This is the bundle's
183
            Loads a resource bundle and stores it in the named scoped variable or
192
fully-qualified resource name, which has the same
184
            the bundle configuration variable
193
form as a fully-qualified class name, that is, it uses
194
"." as the package component separator and does not
195
have any file type (such as ".class" or ".properties")
196
suffix.
197
        </description>
185
        </description>
198
        <name>basename</name>
186
        <name>setBundle</name>
199
        <required>true</required>
187
        <tag-class>org.apache.taglibs.standard.tag.rt.fmt.SetBundleTag</tag-class>
200
        <rtexprvalue>true</rtexprvalue>
188
        <body-content>empty</body-content>
201
    </attribute>
189
        <attribute>
202
    <attribute>
190
            <description>
203
        <description>
191
                Resource bundle base name. This is the bundle's
204
Name of the exported scoped variable which stores
192
                fully-qualified resource name, which has the same
205
the i18n localization context of type
193
                form as a fully-qualified class name, that is, it uses
206
javax.servlet.jsp.jstl.fmt.LocalizationC
194
                "." as the package component separator and does not
207
ontext.
195
                have any file type (such as ".class" or ".properties")
208
        </description>
196
                suffix.
209
        <name>var</name>
197
            </description>
210
        <required>false</required>
198
            <name>basename</name>
211
        <rtexprvalue>false</rtexprvalue>
199
            <required>true</required>
212
    </attribute>
200
            <rtexprvalue>true</rtexprvalue>
213
    <attribute>
201
        </attribute>
214
        <description>
202
        <attribute>
215
Scope of var or the localization context
203
            <description>
216
configuration variable.
204
                Name of the exported scoped variable which stores
217
        </description>
205
                the i18n localization context of type
218
        <name>scope</name>
206
                javax.servlet.jsp.jstl.fmt.LocalizationC
219
        <required>false</required>
207
                ontext.
220
        <rtexprvalue>false</rtexprvalue>
208
            </description>
221
    </attribute>
209
            <name>var</name>
222
  </tag>
210
            <required>false</required>
211
            <rtexprvalue>false</rtexprvalue>
212
        </attribute>
213
        <attribute>
214
            <description>
215
                Scope of var or the localization context
216
                configuration variable.
217
            </description>
218
            <name>scope</name>
219
            <required>false</required>
220
            <rtexprvalue>false</rtexprvalue>
221
        </attribute>
222
    </tag>
223
223
224
  <tag>
224
    <tag>
225
    <description>
226
        Maps key to localized message and performs parametric replacement
227
    </description>
228
    <name>message</name>
229
    <tag-class>org.apache.taglibs.standard.tag.rt.fmt.MessageTag</tag-class>
230
    <body-content>JSP</body-content>
231
    <attribute>
232
        <description>
225
        <description>
233
Message key to be looked up.
226
            Maps key to localized message and performs parametric replacement
234
        </description>
227
        </description>
235
        <name>key</name>
228
        <name>message</name>
236
        <required>false</required>
229
        <tag-class>org.apache.taglibs.standard.tag.rt.fmt.MessageTag</tag-class>
237
        <rtexprvalue>true</rtexprvalue>
230
        <body-content>JSP</body-content>
238
    </attribute>
231
        <attribute>
239
    <attribute>
232
            <description>
240
        <description>
233
                Message key to be looked up.
241
Localization context in whose resource
234
            </description>
242
bundle the message key is looked up.
235
            <name>key</name>
243
        </description>
236
            <required>false</required>
244
        <name>bundle</name>
237
            <rtexprvalue>true</rtexprvalue>
245
        <required>false</required>
238
        </attribute>
246
        <rtexprvalue>true</rtexprvalue>
239
        <attribute>
247
    </attribute>
240
            <description>
248
    <attribute>
241
                Localization context in whose resource
249
        <description>
242
                bundle the message key is looked up.
250
Name of the exported scoped variable
243
            </description>
251
which stores the localized message.
244
            <name>bundle</name>
252
        </description>
245
            <required>false</required>
253
        <name>var</name>
246
            <rtexprvalue>true</rtexprvalue>
254
        <required>false</required>
247
        </attribute>
255
        <rtexprvalue>false</rtexprvalue>
248
        <attribute>
256
    </attribute>
249
            <description>
257
    <attribute>
250
                Name of the exported scoped variable
258
        <description>
251
                which stores the localized message.
259
Scope of var.
252
            </description>
260
        </description>
253
            <name>var</name>
261
        <name>scope</name>
254
            <required>false</required>
262
        <required>false</required>
255
            <rtexprvalue>false</rtexprvalue>
263
        <rtexprvalue>false</rtexprvalue>
256
        </attribute>
264
    </attribute>
257
        <attribute>
265
  </tag>
258
            <description>
259
                Scope of var.
260
            </description>
261
            <name>scope</name>
262
            <required>false</required>
263
            <rtexprvalue>false</rtexprvalue>
264
        </attribute>
265
    </tag>
266
266
267
  <tag>
267
    <tag>
268
    <description>
269
        Supplies an argument for parametric replacement to a containing
270
        &lt;message&gt; tag
271
    </description>
272
    <name>param</name>
273
    <tag-class>org.apache.taglibs.standard.tag.rt.fmt.ParamTag</tag-class>
274
    <body-content>JSP</body-content>
275
    <attribute>
276
        <description>
268
        <description>
277
Argument used for parametric replacement.
269
            Supplies an argument for parametric replacement to a containing
270
            &lt;message&gt; tag
278
        </description>
271
        </description>
279
        <name>value</name>
272
        <name>param</name>
280
        <required>false</required>
273
        <tag-class>org.apache.taglibs.standard.tag.rt.fmt.ParamTag</tag-class>
281
        <rtexprvalue>true</rtexprvalue>
274
        <body-content>JSP</body-content>
282
    </attribute>
275
        <attribute>
283
  </tag>
276
            <description>
277
                Argument used for parametric replacement.
278
            </description>
279
            <name>value</name>
280
            <required>false</required>
281
            <rtexprvalue>true</rtexprvalue>
282
        </attribute>
283
    </tag>
284
284
285
  <tag>
285
    <tag>
286
    <description>
287
        Formats a numeric value as a number, currency, or percentage
288
    </description>
289
    <name>formatNumber</name>
290
    <tag-class>org.apache.taglibs.standard.tag.rt.fmt.FormatNumberTag</tag-class>
291
    <body-content>JSP</body-content>
292
    <attribute>
293
        <description>
286
        <description>
294
Numeric value to be formatted.
287
            Formats a numeric value as a number, currency, or percentage
295
        </description>
288
        </description>
296
        <name>value</name>
289
        <name>formatNumber</name>
297
        <required>false</required>
290
        <tag-class>org.apache.taglibs.standard.tag.rt.fmt.FormatNumberTag</tag-class>
298
        <rtexprvalue>true</rtexprvalue>
291
        <body-content>JSP</body-content>
299
    </attribute>
292
        <attribute>
300
    <attribute>
293
            <description>
301
        <description>
294
                Numeric value to be formatted.
302
Specifies whether the value is to be
295
            </description>
303
formatted as number, currency, or
296
            <name>value</name>
304
percentage.
297
            <required>false</required>
305
        </description>
298
            <rtexprvalue>true</rtexprvalue>
306
        <name>type</name>
299
        </attribute>
307
        <required>false</required>
300
        <attribute>
308
        <rtexprvalue>true</rtexprvalue>
301
            <description>
309
    </attribute>
302
                Specifies whether the value is to be
310
    <attribute>
303
                formatted as number, currency, or
311
        <description>
304
                percentage.
312
Custom formatting pattern.
305
            </description>
313
        </description>
306
            <name>type</name>
314
        <name>pattern</name>
307
            <required>false</required>
315
        <required>false</required>
308
            <rtexprvalue>true</rtexprvalue>
316
        <rtexprvalue>true</rtexprvalue>
309
        </attribute>
317
    </attribute>
310
        <attribute>
318
    <attribute>
311
            <description>
319
        <description>
312
                Custom formatting pattern.
320
ISO 4217 currency code. Applied only
313
            </description>
321
when formatting currencies (i.e. if type is
314
            <name>pattern</name>
322
equal to "currency"); ignored otherwise.
315
            <required>false</required>
323
        </description>
316
            <rtexprvalue>true</rtexprvalue>
324
        <name>currencyCode</name>
317
        </attribute>
325
        <required>false</required>
318
        <attribute>
326
        <rtexprvalue>true</rtexprvalue>
319
            <description>
327
    </attribute>
320
                ISO 4217 currency code. Applied only
328
    <attribute>
321
                when formatting currencies (i.e. if type is
329
        <description>
322
                equal to "currency"); ignored otherwise.
330
Currency symbol. Applied only when
323
            </description>
331
formatting currencies (i.e. if type is equal
324
            <name>currencyCode</name>
332
to "currency"); ignored otherwise.
325
            <required>false</required>
333
        </description>
326
            <rtexprvalue>true</rtexprvalue>
334
        <name>currencySymbol</name>
327
        </attribute>
335
        <required>false</required>
328
        <attribute>
336
        <rtexprvalue>true</rtexprvalue>
329
            <description>
337
    </attribute>
330
                Currency symbol. Applied only when
338
    <attribute>
331
                formatting currencies (i.e. if type is equal
339
        <description>
332
                to "currency"); ignored otherwise.
340
Specifies whether the formatted output
333
            </description>
341
will contain any grouping separators.
334
            <name>currencySymbol</name>
342
        </description>
335
            <required>false</required>
343
        <name>groupingUsed</name>
336
            <rtexprvalue>true</rtexprvalue>
344
        <required>false</required>
337
        </attribute>
345
        <rtexprvalue>true</rtexprvalue>
338
        <attribute>
346
    </attribute>
339
            <description>
347
    <attribute>
340
                Specifies whether the formatted output
348
        <description>
341
                will contain any grouping separators.
349
Maximum number of digits in the integer
342
            </description>
350
portion of the formatted output.
343
            <name>groupingUsed</name>
351
        </description>
344
            <required>false</required>
352
        <name>maxIntegerDigits</name>
345
            <rtexprvalue>true</rtexprvalue>
353
        <required>false</required>
346
        </attribute>
354
        <rtexprvalue>true</rtexprvalue>
347
        <attribute>
355
    </attribute>
348
            <description>
356
    <attribute>
349
                Maximum number of digits in the integer
357
        <description>
350
                portion of the formatted output.
358
Minimum number of digits in the integer
351
            </description>
359
portion of the formatted output.
352
            <name>maxIntegerDigits</name>
360
        </description>
353
            <required>false</required>
361
        <name>minIntegerDigits</name>
354
            <rtexprvalue>true</rtexprvalue>
362
        <required>false</required>
355
        </attribute>
363
        <rtexprvalue>true</rtexprvalue>
356
        <attribute>
364
    </attribute>
357
            <description>
365
    <attribute>
358
                Minimum number of digits in the integer
366
        <description>
359
                portion of the formatted output.
367
Maximum number of digits in the
360
            </description>
368
fractional portion of the formatted output.
361
            <name>minIntegerDigits</name>
369
        </description>
362
            <required>false</required>
370
        <name>maxFractionDigits</name>
363
            <rtexprvalue>true</rtexprvalue>
371
        <required>false</required>
364
        </attribute>
372
        <rtexprvalue>true</rtexprvalue>
365
        <attribute>
373
    </attribute>
366
            <description>
374
    <attribute>
367
                Maximum number of digits in the
375
        <description>
368
                fractional portion of the formatted output.
376
Minimum number of digits in the
369
            </description>
377
fractional portion of the formatted output.
370
            <name>maxFractionDigits</name>
378
        </description>
371
            <required>false</required>
379
        <name>minFractionDigits</name>
372
            <rtexprvalue>true</rtexprvalue>
380
        <required>false</required>
373
        </attribute>
381
        <rtexprvalue>true</rtexprvalue>
374
        <attribute>
382
    </attribute>
375
            <description>
383
    <attribute>
376
                Minimum number of digits in the
384
        <description>
377
                fractional portion of the formatted output.
385
Name of the exported scoped variable
378
            </description>
386
which stores the formatted result as a
379
            <name>minFractionDigits</name>
387
String.
380
            <required>false</required>
388
        </description>
381
            <rtexprvalue>true</rtexprvalue>
389
        <name>var</name>
382
        </attribute>
390
        <required>false</required>
383
        <attribute>
391
        <rtexprvalue>false</rtexprvalue>
384
            <description>
392
    </attribute>
385
                Name of the exported scoped variable
393
    <attribute>
386
                which stores the formatted result as a
394
        <description>
387
                String.
395
Scope of var.
388
            </description>
396
        </description>
389
            <name>var</name>
397
        <name>scope</name>
390
            <required>false</required>
398
        <required>false</required>
391
            <rtexprvalue>false</rtexprvalue>
399
        <rtexprvalue>false</rtexprvalue>
392
        </attribute>
400
    </attribute>
393
        <attribute>
401
  </tag>
394
            <description>
395
                Scope of var.
396
            </description>
397
            <name>scope</name>
398
            <required>false</required>
399
            <rtexprvalue>false</rtexprvalue>
400
        </attribute>
401
    </tag>
402
402
403
  <tag>
403
    <tag>
404
    <description>
405
        Parses the string representation of a number, currency, or percentage
406
    </description>
407
    <name>parseNumber</name>
408
    <tag-class>org.apache.taglibs.standard.tag.rt.fmt.ParseNumberTag</tag-class>
409
    <body-content>JSP</body-content>
410
    <attribute>
411
        <description>
404
        <description>
412
String to be parsed.
405
            Parses the string representation of a number, currency, or percentage
413
        </description>
406
        </description>
414
        <name>value</name>
407
        <name>parseNumber</name>
415
        <required>false</required>
408
        <tag-class>org.apache.taglibs.standard.tag.rt.fmt.ParseNumberTag</tag-class>
416
        <rtexprvalue>true</rtexprvalue>
409
        <body-content>JSP</body-content>
417
    </attribute>
410
        <attribute>
418
    <attribute>
411
            <description>
419
        <description>
412
                String to be parsed.
420
Specifies whether the string in the value
413
            </description>
421
attribute should be parsed as a number,
414
            <name>value</name>
422
currency, or percentage.
415
            <required>false</required>
423
        </description>
416
            <rtexprvalue>true</rtexprvalue>
424
        <name>type</name>
417
        </attribute>
425
        <required>false</required>
418
        <attribute>
426
        <rtexprvalue>true</rtexprvalue>
419
            <description>
427
    </attribute>
420
                Specifies whether the string in the value
428
    <attribute>
421
                attribute should be parsed as a number,
429
        <description>
422
                currency, or percentage.
430
Custom formatting pattern that determines
423
            </description>
431
how the string in the value attribute is to be
424
            <name>type</name>
432
parsed.
425
            <required>false</required>
433
        </description>
426
            <rtexprvalue>true</rtexprvalue>
434
        <name>pattern</name>
427
        </attribute>
435
        <required>false</required>
428
        <attribute>
436
        <rtexprvalue>true</rtexprvalue>
429
            <description>
437
    </attribute>
430
                Custom formatting pattern that determines
438
    <attribute>
431
                how the string in the value attribute is to be
439
        <description>
432
                parsed.
440
Locale whose default formatting pattern (for
433
            </description>
441
numbers, currencies, or percentages,
434
            <name>pattern</name>
442
respectively) is to be used during the parse
435
            <required>false</required>
443
operation, or to which the pattern specified
436
            <rtexprvalue>true</rtexprvalue>
444
via the pattern attribute (if present) is
437
        </attribute>
445
applied.
438
        <attribute>
446
        </description>
439
            <description>
447
        <name>parseLocale</name>
440
                Locale whose default formatting pattern (for
448
        <required>false</required>
441
                numbers, currencies, or percentages,
449
        <rtexprvalue>true</rtexprvalue>
442
                respectively) is to be used during the parse
450
    </attribute>
443
                operation, or to which the pattern specified
451
    <attribute>
444
                via the pattern attribute (if present) is
452
        <description>
445
                applied.
453
Specifies whether just the integer portion of
446
            </description>
454
the given value should be parsed.
447
            <name>parseLocale</name>
455
        </description>
448
            <required>false</required>
456
        <name>integerOnly</name>
449
            <rtexprvalue>true</rtexprvalue>
457
        <required>false</required>
450
        </attribute>
458
        <rtexprvalue>true</rtexprvalue>
451
        <attribute>
459
    </attribute>
452
            <description>
460
    <attribute>
453
                Specifies whether just the integer portion of
461
        <description>
454
                the given value should be parsed.
462
Name of the exported scoped variable which
455
            </description>
463
stores the parsed result (of type
456
            <name>integerOnly</name>
464
java.lang.Number).
457
            <required>false</required>
465
        </description>
458
            <rtexprvalue>true</rtexprvalue>
466
        <name>var</name>
459
        </attribute>
467
        <required>false</required>
460
        <attribute>
468
        <rtexprvalue>false</rtexprvalue>
461
            <description>
469
    </attribute>
462
                Name of the exported scoped variable which
470
    <attribute>
463
                stores the parsed result (of type
471
        <description>
464
                java.lang.Number).
472
Scope of var.
465
            </description>
473
        </description>
466
            <name>var</name>
474
        <name>scope</name>
467
            <required>false</required>
475
        <required>false</required>
468
            <rtexprvalue>false</rtexprvalue>
476
        <rtexprvalue>false</rtexprvalue>
469
        </attribute>
477
    </attribute>
470
        <attribute>
478
  </tag>
471
            <description>
472
                Scope of var.
473
            </description>
474
            <name>scope</name>
475
            <required>false</required>
476
            <rtexprvalue>false</rtexprvalue>
477
        </attribute>
478
    </tag>
479
479
480
  <tag>
480
    <tag>
481
    <description>
482
        Formats a date and/or time using the supplied styles and pattern
483
    </description>
484
    <name>formatDate</name>
485
    <tag-class>org.apache.taglibs.standard.tag.rt.fmt.FormatDateTag</tag-class>
486
    <body-content>empty</body-content>
487
    <attribute>
488
        <description>
481
        <description>
489
Date and/or time to be formatted.
482
            Formats a date and/or time using the supplied styles and pattern
490
        </description>
483
        </description>
491
        <name>value</name>
484
        <name>formatDate</name>
492
        <required>true</required>
485
        <tag-class>org.apache.taglibs.standard.tag.rt.fmt.FormatDateTag</tag-class>
493
        <rtexprvalue>true</rtexprvalue>
486
        <body-content>empty</body-content>
494
    </attribute>
487
        <attribute>
495
    <attribute>
488
            <description>
496
        <description>
489
                Date and/or time to be formatted.
497
Specifies whether the time, the date, or both
490
            </description>
498
the time and date components of the given
491
            <name>value</name>
499
date are to be formatted. 
492
            <required>true</required>
500
        </description>
493
            <rtexprvalue>true</rtexprvalue>
501
        <name>type</name>
494
        </attribute>
502
        <required>false</required>
495
        <attribute>
503
        <rtexprvalue>true</rtexprvalue>
496
            <description>
504
    </attribute>
497
                Specifies whether the time, the date, or both
505
    <attribute>
498
                the time and date components of the given
506
        <description>
499
                date are to be formatted.
507
Predefined formatting style for dates. Follows
500
            </description>
508
the semantics defined in class
501
            <name>type</name>
509
java.text.DateFormat. Applied only
502
            <required>false</required>
510
when formatting a date or both a date and
503
            <rtexprvalue>true</rtexprvalue>
511
time (i.e. if type is missing or is equal to
504
        </attribute>
512
"date" or "both"); ignored otherwise.
505
        <attribute>
513
        </description>
506
            <description>
514
        <name>dateStyle</name>
507
                Predefined formatting style for dates. Follows
515
        <required>false</required>
508
                the semantics defined in class
516
        <rtexprvalue>true</rtexprvalue>
509
                java.text.DateFormat. Applied only
517
    </attribute>
510
                when formatting a date or both a date and
518
    <attribute>
511
                time (i.e. if type is missing or is equal to
519
        <description>
512
                "date" or "both"); ignored otherwise.
520
Predefined formatting style for times. Follows
513
            </description>
521
the semantics defined in class
514
            <name>dateStyle</name>
522
java.text.DateFormat. Applied only
515
            <required>false</required>
523
when formatting a time or both a date and
516
            <rtexprvalue>true</rtexprvalue>
524
time (i.e. if type is equal to "time" or "both");
517
        </attribute>
525
ignored otherwise.
518
        <attribute>
526
        </description>
519
            <description>
527
        <name>timeStyle</name>
520
                Predefined formatting style for times. Follows
528
        <required>false</required>
521
                the semantics defined in class
529
        <rtexprvalue>true</rtexprvalue>
522
                java.text.DateFormat. Applied only
530
    </attribute>
523
                when formatting a time or both a date and
531
    <attribute>
524
                time (i.e. if type is equal to "time" or "both");
532
        <description>
525
                ignored otherwise.
533
Custom formatting style for dates and times.
526
            </description>
534
        </description>
527
            <name>timeStyle</name>
535
        <name>pattern</name>
528
            <required>false</required>
536
        <required>false</required>
529
            <rtexprvalue>true</rtexprvalue>
537
        <rtexprvalue>true</rtexprvalue>
530
        </attribute>
538
    </attribute>
531
        <attribute>
539
    <attribute>
532
            <description>
540
        <description>
533
                Custom formatting style for dates and times.
541
Time zone in which to represent the formatted
534
            </description>
542
time.
535
            <name>pattern</name>
543
        </description>
536
            <required>false</required>
544
        <name>timeZone</name>
537
            <rtexprvalue>true</rtexprvalue>
545
        <required>false</required>
538
        </attribute>
546
        <rtexprvalue>true</rtexprvalue>
539
        <attribute>
547
    </attribute>
540
            <description>
548
    <attribute>
541
                Time zone in which to represent the formatted
549
        <description>
542
                time.
550
Name of the exported scoped variable which
543
            </description>
551
stores the formatted result as a String.
544
            <name>timeZone</name>
552
        </description>
545
            <required>false</required>
553
        <name>var</name>
546
            <rtexprvalue>true</rtexprvalue>
554
        <required>false</required>
547
        </attribute>
555
        <rtexprvalue>false</rtexprvalue>
548
        <attribute>
556
    </attribute>
549
            <description>
557
    <attribute>
550
                Name of the exported scoped variable which
558
        <description>
551
                stores the formatted result as a String.
559
Scope of var.
552
            </description>
560
        </description>
553
            <name>var</name>
561
        <name>scope</name>
554
            <required>false</required>
562
        <required>false</required>
555
            <rtexprvalue>false</rtexprvalue>
563
        <rtexprvalue>false</rtexprvalue>
556
        </attribute>
564
    </attribute>
557
        <attribute>
565
  </tag>
558
            <description>
559
                Scope of var.
560
            </description>
561
            <name>scope</name>
562
            <required>false</required>
563
            <rtexprvalue>false</rtexprvalue>
564
        </attribute>
565
    </tag>
566
566
567
  <tag>
567
    <tag>
568
    <description>
569
        Parses the string representation of a date and/or time
570
    </description>
571
    <name>parseDate</name>
572
    <tag-class>org.apache.taglibs.standard.tag.rt.fmt.ParseDateTag</tag-class>
573
    <body-content>JSP</body-content>
574
    <attribute>
575
        <description>
568
        <description>
576
Date string to be parsed.
569
            Parses the string representation of a date and/or time
577
        </description>
570
        </description>
578
        <name>value</name>
571
        <name>parseDate</name>
579
        <required>false</required>
572
        <tag-class>org.apache.taglibs.standard.tag.rt.fmt.ParseDateTag</tag-class>
580
        <rtexprvalue>true</rtexprvalue>
573
        <body-content>JSP</body-content>
581
    </attribute>
574
        <attribute>
582
    <attribute>
575
            <description>
583
        <description>
576
                Date string to be parsed.
584
Specifies whether the date string in the
577
            </description>
585
value attribute is supposed to contain a
578
            <name>value</name>
586
time, a date, or both.
579
            <required>false</required>
587
        </description>
580
            <rtexprvalue>true</rtexprvalue>
588
        <name>type</name>
581
        </attribute>
589
        <required>false</required>
582
        <attribute>
590
        <rtexprvalue>true</rtexprvalue>
583
            <description>
591
    </attribute>
584
                Specifies whether the date string in the
592
    <attribute>
585
                value attribute is supposed to contain a
593
        <description>
586
                time, a date, or both.
594
Predefined formatting style for days
587
            </description>
595
which determines how the date
588
            <name>type</name>
596
component of the date string is to be
589
            <required>false</required>
597
parsed. Applied only when formatting a
590
            <rtexprvalue>true</rtexprvalue>
598
date or both a date and time (i.e. if type
591
        </attribute>
599
is missing or is equal to "date" or "both");
592
        <attribute>
600
ignored otherwise.
593
            <description>
601
        </description>
594
                Predefined formatting style for days
602
        <name>dateStyle</name>
595
                which determines how the date
603
        <required>false</required>
596
                component of the date string is to be
604
        <rtexprvalue>true</rtexprvalue>
597
                parsed. Applied only when formatting a
605
    </attribute>
598
                date or both a date and time (i.e. if type
606
    <attribute>
599
                is missing or is equal to "date" or "both");
607
        <description>
600
                ignored otherwise.
608
Predefined formatting styles for times
601
            </description>
609
which determines how the time
602
            <name>dateStyle</name>
610
component in the date string is to be
603
            <required>false</required>
611
parsed. Applied only when formatting a
604
            <rtexprvalue>true</rtexprvalue>
612
time or both a date and time (i.e. if type
605
        </attribute>
613
is equal to "time" or "both"); ignored
606
        <attribute>
614
otherwise.
607
            <description>
615
        </description>
608
                Predefined formatting styles for times
616
        <name>timeStyle</name>
609
                which determines how the time
617
        <required>false</required>
610
                component in the date string is to be
618
        <rtexprvalue>true</rtexprvalue>
611
                parsed. Applied only when formatting a
619
    </attribute>
612
                time or both a date and time (i.e. if type
620
    <attribute>
613
                is equal to "time" or "both"); ignored
621
        <description>
614
                otherwise.
622
Custom formatting pattern which
615
            </description>
623
determines how the date string is to be
616
            <name>timeStyle</name>
624
parsed.
617
            <required>false</required>
625
        </description>
618
            <rtexprvalue>true</rtexprvalue>
626
        <name>pattern</name>
619
        </attribute>
627
        <required>false</required>
620
        <attribute>
628
        <rtexprvalue>true</rtexprvalue>
621
            <description>
629
    </attribute>
622
                Custom formatting pattern which
630
    <attribute>
623
                determines how the date string is to be
631
        <description>
624
                parsed.
632
Time zone in which to interpret any time
625
            </description>
633
information in the date string.
626
            <name>pattern</name>
634
        </description>
627
            <required>false</required>
635
        <name>timeZone</name>
628
            <rtexprvalue>true</rtexprvalue>
636
        <required>false</required>
629
        </attribute>
637
        <rtexprvalue>true</rtexprvalue>
630
        <attribute>
638
    </attribute>
631
            <description>
639
    <attribute>
632
                Time zone in which to interpret any time
640
        <description>
633
                information in the date string.
641
Locale whose predefined formatting styles
634
            </description>
642
for dates and times are to be used during
635
            <name>timeZone</name>
643
the parse operation, or to which the
636
            <required>false</required>
644
pattern specified via the pattern
637
            <rtexprvalue>true</rtexprvalue>
645
attribute (if present) is applied.
638
        </attribute>
646
        </description>
639
        <attribute>
647
        <name>parseLocale</name>
640
            <description>
648
        <required>false</required>
641
                Locale whose predefined formatting styles
649
        <rtexprvalue>true</rtexprvalue>
642
                for dates and times are to be used during
650
    </attribute>
643
                the parse operation, or to which the
651
    <attribute>
644
                pattern specified via the pattern
652
        <description>
645
                attribute (if present) is applied.
653
Name of the exported scoped variable in
646
            </description>
654
which the parsing result (of type
647
            <name>parseLocale</name>
655
java.util.Date) is stored.
648
            <required>false</required>
656
        </description>
649
            <rtexprvalue>true</rtexprvalue>
657
        <name>var</name>
650
        </attribute>
658
        <required>false</required>
651
        <attribute>
659
        <rtexprvalue>false</rtexprvalue>
652
            <description>
660
    </attribute>
653
                Name of the exported scoped variable in
661
    <attribute>
654
                which the parsing result (of type
662
        <description>
655
                java.util.Date) is stored.
663
Scope of var.
656
            </description>
664
        </description>
657
            <name>var</name>
665
        <name>scope</name>
658
            <required>false</required>
666
        <required>false</required>
659
            <rtexprvalue>false</rtexprvalue>
667
        <rtexprvalue>false</rtexprvalue>
660
        </attribute>
668
    </attribute>
661
        <attribute>
669
  </tag>
662
            <description>
663
                Scope of var.
664
            </description>
665
            <name>scope</name>
666
            <required>false</required>
667
            <rtexprvalue>false</rtexprvalue>
668
        </attribute>
669
    </tag>
670
670
671
</taglib>
671
</taglib>
(-)src/main/resources/META-INF/fmt-1_0-rt.tld (-385 / +385 lines)
Lines 1-403 Link Here
1
<?xml version="1.0" encoding="ISO-8859-1" ?>
1
<?xml version="1.0" encoding="ISO-8859-1" ?>
2
<!DOCTYPE taglib
2
<!DOCTYPE taglib
3
  PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
3
        PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
4
  "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
4
        "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
5
<taglib>
5
<taglib>
6
  <tlib-version>1.0</tlib-version>
6
    <tlib-version>1.0</tlib-version>
7
  <jsp-version>1.2</jsp-version>
7
    <jsp-version>1.2</jsp-version>
8
  <short-name>fmt_rt</short-name>
8
    <short-name>fmt_rt</short-name>
9
  <uri>http://java.sun.com/jstl/fmt_rt</uri>
9
    <uri>http://java.sun.com/jstl/fmt_rt</uri>
10
  <display-name>JSTL fmt RT</display-name>
10
    <display-name>JSTL fmt RT</display-name>
11
  <description>JSTL 1.0 i18n-capable formatting library</description>
11
    <description>JSTL 1.0 i18n-capable formatting library</description>
12
12
13
  <validator>
13
    <validator>
14
    <validator-class>
14
        <validator-class>
15
        org.apache.taglibs.standard.tlv.JstlFmtTLV
15
            org.apache.taglibs.standard.tlv.JstlFmtTLV
16
    </validator-class>
16
        </validator-class>
17
    <description>
17
        <description>
18
        Provides core validation features for JSTL tags.
18
            Provides core validation features for JSTL tags.
19
    </description>
19
        </description>
20
  </validator>
20
    </validator>
21
21
22
  <tag>
22
    <tag>
23
    <name>requestEncoding</name>
23
        <name>requestEncoding</name>
24
    <tag-class>org.apache.taglibs.standard.tag.rt.fmt.RequestEncodingTag</tag-class>
24
        <tag-class>org.apache.taglibs.standard.tag.rt.fmt.RequestEncodingTag</tag-class>
25
    <body-content>empty</body-content>
25
        <body-content>empty</body-content>
26
    <description>
26
        <description>
27
        Sets the request character encoding
27
            Sets the request character encoding
28
    </description>
28
        </description>
29
    <attribute>
29
        <attribute>
30
        <name>value</name>
30
            <name>value</name>
31
        <required>false</required>
31
            <required>false</required>
32
        <rtexprvalue>true</rtexprvalue>
32
            <rtexprvalue>true</rtexprvalue>
33
    </attribute>
33
        </attribute>
34
  </tag>
34
    </tag>
35
35
36
  <tag>
36
    <tag>
37
    <name>setLocale</name>
37
        <name>setLocale</name>
38
    <tag-class>org.apache.taglibs.standard.tag.rt.fmt.SetLocaleTag</tag-class>
38
        <tag-class>org.apache.taglibs.standard.tag.rt.fmt.SetLocaleTag</tag-class>
39
    <body-content>empty</body-content>
39
        <body-content>empty</body-content>
40
    <description>
40
        <description>
41
        Stores the given locale in the locale configuration variable
41
            Stores the given locale in the locale configuration variable
42
    </description>
42
        </description>
43
    <attribute>
43
        <attribute>
44
        <name>value</name>
44
            <name>value</name>
45
        <required>true</required>
45
            <required>true</required>
46
        <rtexprvalue>true</rtexprvalue>
46
            <rtexprvalue>true</rtexprvalue>
47
    </attribute>
47
        </attribute>
48
    <attribute>
48
        <attribute>
49
        <name>variant</name>
49
            <name>variant</name>
50
        <required>false</required>
50
            <required>false</required>
51
        <rtexprvalue>true</rtexprvalue>
51
            <rtexprvalue>true</rtexprvalue>
52
    </attribute>
52
        </attribute>
53
    <attribute>
53
        <attribute>
54
        <name>scope</name>
54
            <name>scope</name>
55
        <required>false</required>
55
            <required>false</required>
56
        <rtexprvalue>false</rtexprvalue>
56
            <rtexprvalue>false</rtexprvalue>
57
    </attribute>
57
        </attribute>
58
  </tag>
58
    </tag>
59
59
60
  <tag>
60
    <tag>
61
    <name>timeZone</name>
61
        <name>timeZone</name>
62
    <tag-class>org.apache.taglibs.standard.tag.rt.fmt.TimeZoneTag</tag-class>
62
        <tag-class>org.apache.taglibs.standard.tag.rt.fmt.TimeZoneTag</tag-class>
63
    <body-content>JSP</body-content>
63
        <body-content>JSP</body-content>
64
    <description>
64
        <description>
65
        Specifies the time zone for any time formatting or parsing actions
65
            Specifies the time zone for any time formatting or parsing actions
66
        nested in its body
66
            nested in its body
67
    </description>
67
        </description>
68
    <attribute>
68
        <attribute>
69
        <name>value</name>
69
            <name>value</name>
70
        <required>true</required>
70
            <required>true</required>
71
        <rtexprvalue>true</rtexprvalue>
71
            <rtexprvalue>true</rtexprvalue>
72
    </attribute>
72
        </attribute>
73
  </tag>
73
    </tag>
74
74
75
  <tag>
75
    <tag>
76
    <name>setTimeZone</name>
76
        <name>setTimeZone</name>
77
    <tag-class>org.apache.taglibs.standard.tag.rt.fmt.SetTimeZoneTag</tag-class>
77
        <tag-class>org.apache.taglibs.standard.tag.rt.fmt.SetTimeZoneTag</tag-class>
78
    <body-content>empty</body-content>
78
        <body-content>empty</body-content>
79
    <description>
79
        <description>
80
        Stores the given time zone in the time zone configuration variable
80
            Stores the given time zone in the time zone configuration variable
81
    </description>
81
        </description>
82
    <attribute>
82
        <attribute>
83
        <name>value</name>
83
            <name>value</name>
84
        <required>true</required>
84
            <required>true</required>
85
        <rtexprvalue>true</rtexprvalue>
85
            <rtexprvalue>true</rtexprvalue>
86
    </attribute>
86
        </attribute>
87
    <attribute>
87
        <attribute>
88
        <name>var</name>
88
            <name>var</name>
89
        <required>false</required>
89
            <required>false</required>
90
        <rtexprvalue>false</rtexprvalue>
90
            <rtexprvalue>false</rtexprvalue>
91
    </attribute>
91
        </attribute>
92
    <attribute>
92
        <attribute>
93
        <name>scope</name>
93
            <name>scope</name>
94
        <required>false</required>
94
            <required>false</required>
95
        <rtexprvalue>false</rtexprvalue>
95
            <rtexprvalue>false</rtexprvalue>
96
    </attribute>
96
        </attribute>
97
  </tag>
97
    </tag>
98
98
99
  <tag>
99
    <tag>
100
    <name>bundle</name>
100
        <name>bundle</name>
101
    <tag-class>org.apache.taglibs.standard.tag.rt.fmt.BundleTag</tag-class>
101
        <tag-class>org.apache.taglibs.standard.tag.rt.fmt.BundleTag</tag-class>
102
    <body-content>JSP</body-content>
102
        <body-content>JSP</body-content>
103
    <description>
103
        <description>
104
        Loads a resource bundle to be used by its tag body
104
            Loads a resource bundle to be used by its tag body
105
    </description>
105
        </description>
106
    <attribute>
106
        <attribute>
107
        <name>basename</name>
107
            <name>basename</name>
108
        <required>true</required>
108
            <required>true</required>
109
        <rtexprvalue>true</rtexprvalue>
109
            <rtexprvalue>true</rtexprvalue>
110
    </attribute>
110
        </attribute>
111
    <attribute>
111
        <attribute>
112
        <name>prefix</name>
112
            <name>prefix</name>
113
        <required>false</required>
113
            <required>false</required>
114
        <rtexprvalue>true</rtexprvalue>
114
            <rtexprvalue>true</rtexprvalue>
115
    </attribute>
115
        </attribute>
116
  </tag>
116
    </tag>
117
117
118
  <tag>
118
    <tag>
119
    <name>setBundle</name>
119
        <name>setBundle</name>
120
    <tag-class>org.apache.taglibs.standard.tag.rt.fmt.SetBundleTag</tag-class>
120
        <tag-class>org.apache.taglibs.standard.tag.rt.fmt.SetBundleTag</tag-class>
121
    <body-content>empty</body-content>
121
        <body-content>empty</body-content>
122
    <description>
122
        <description>
123
        Loads a resource bundle and stores it in the named scoped variable or
123
            Loads a resource bundle and stores it in the named scoped variable or
124
        the bundle configuration variable
124
            the bundle configuration variable
125
    </description>
125
        </description>
126
    <attribute>
126
        <attribute>
127
        <name>basename</name>
127
            <name>basename</name>
128
        <required>true</required>
128
            <required>true</required>
129
        <rtexprvalue>true</rtexprvalue>
129
            <rtexprvalue>true</rtexprvalue>
130
    </attribute>
130
        </attribute>
131
    <attribute>
131
        <attribute>
132
        <name>var</name>
132
            <name>var</name>
133
        <required>false</required>
133
            <required>false</required>
134
        <rtexprvalue>false</rtexprvalue>
134
            <rtexprvalue>false</rtexprvalue>
135
    </attribute>
135
        </attribute>
136
    <attribute>
136
        <attribute>
137
        <name>scope</name>
137
            <name>scope</name>
138
        <required>false</required>
138
            <required>false</required>
139
        <rtexprvalue>false</rtexprvalue>
139
            <rtexprvalue>false</rtexprvalue>
140
    </attribute>
140
        </attribute>
141
  </tag>
141
    </tag>
142
142
143
  <tag>
143
    <tag>
144
    <name>message</name>
144
        <name>message</name>
145
    <tag-class>org.apache.taglibs.standard.tag.rt.fmt.MessageTag</tag-class>
145
        <tag-class>org.apache.taglibs.standard.tag.rt.fmt.MessageTag</tag-class>
146
    <body-content>JSP</body-content>
146
        <body-content>JSP</body-content>
147
    <description>
147
        <description>
148
        Maps key to localized message and performs parametric replacement
148
            Maps key to localized message and performs parametric replacement
149
    </description>
149
        </description>
150
    <attribute>
150
        <attribute>
151
        <name>key</name>
151
            <name>key</name>
152
        <required>false</required>
152
            <required>false</required>
153
        <rtexprvalue>true</rtexprvalue>
153
            <rtexprvalue>true</rtexprvalue>
154
    </attribute>
154
        </attribute>
155
    <attribute>
155
        <attribute>
156
        <name>bundle</name>
156
            <name>bundle</name>
157
        <required>false</required>
157
            <required>false</required>
158
        <rtexprvalue>true</rtexprvalue>
158
            <rtexprvalue>true</rtexprvalue>
159
    </attribute>
159
        </attribute>
160
    <attribute>
160
        <attribute>
161
        <name>var</name>
161
            <name>var</name>
162
        <required>false</required>
162
            <required>false</required>
163
        <rtexprvalue>false</rtexprvalue>
163
            <rtexprvalue>false</rtexprvalue>
164
    </attribute>
164
        </attribute>
165
    <attribute>
165
        <attribute>
166
        <name>scope</name>
166
            <name>scope</name>
167
        <required>false</required>
167
            <required>false</required>
168
        <rtexprvalue>false</rtexprvalue>
168
            <rtexprvalue>false</rtexprvalue>
169
    </attribute>
169
        </attribute>
170
  </tag>
170
    </tag>
171
171
172
  <tag>
172
    <tag>
173
    <name>param</name>
173
        <name>param</name>
174
    <tag-class>org.apache.taglibs.standard.tag.rt.fmt.ParamTag</tag-class>
174
        <tag-class>org.apache.taglibs.standard.tag.rt.fmt.ParamTag</tag-class>
175
    <body-content>JSP</body-content>
175
        <body-content>JSP</body-content>
176
    <description>
176
        <description>
177
        Supplies an argument for parametric replacement to a containing
177
            Supplies an argument for parametric replacement to a containing
178
        &lt;message&gt; tag
178
            &lt;message&gt; tag
179
    </description>
179
        </description>
180
    <attribute>
180
        <attribute>
181
        <name>value</name>
181
            <name>value</name>
182
        <required>false</required>
182
            <required>false</required>
183
        <rtexprvalue>true</rtexprvalue>
183
            <rtexprvalue>true</rtexprvalue>
184
    </attribute>
184
        </attribute>
185
  </tag>
185
    </tag>
186
186
187
  <tag>
187
    <tag>
188
    <name>formatNumber</name>
188
        <name>formatNumber</name>
189
    <tag-class>org.apache.taglibs.standard.tag.rt.fmt.FormatNumberTag</tag-class>
189
        <tag-class>org.apache.taglibs.standard.tag.rt.fmt.FormatNumberTag</tag-class>
190
    <body-content>JSP</body-content>
190
        <body-content>JSP</body-content>
191
    <description>
191
        <description>
192
        Formats a numeric value as a number, currency, or percentage
192
            Formats a numeric value as a number, currency, or percentage
193
    </description>
193
        </description>
194
    <attribute>
194
        <attribute>
195
        <name>value</name>
195
            <name>value</name>
196
        <required>false</required>
196
            <required>false</required>
197
        <rtexprvalue>true</rtexprvalue>
197
            <rtexprvalue>true</rtexprvalue>
198
    </attribute>
198
        </attribute>
199
    <attribute>
199
        <attribute>
200
        <name>type</name>
200
            <name>type</name>
201
        <required>false</required>
201
            <required>false</required>
202
        <rtexprvalue>true</rtexprvalue>
202
            <rtexprvalue>true</rtexprvalue>
203
    </attribute>
203
        </attribute>
204
    <attribute>
204
        <attribute>
205
        <name>pattern</name>
205
            <name>pattern</name>
206
        <required>false</required>
206
            <required>false</required>
207
        <rtexprvalue>true</rtexprvalue>
207
            <rtexprvalue>true</rtexprvalue>
208
    </attribute>
208
        </attribute>
209
    <attribute>
209
        <attribute>
210
        <name>currencyCode</name>
210
            <name>currencyCode</name>
211
        <required>false</required>
211
            <required>false</required>
212
        <rtexprvalue>true</rtexprvalue>
212
            <rtexprvalue>true</rtexprvalue>
213
    </attribute>
213
        </attribute>
214
    <attribute>
214
        <attribute>
215
        <name>currencySymbol</name>
215
            <name>currencySymbol</name>
216
        <required>false</required>
216
            <required>false</required>
217
        <rtexprvalue>true</rtexprvalue>
217
            <rtexprvalue>true</rtexprvalue>
218
    </attribute>
218
        </attribute>
219
    <attribute>
219
        <attribute>
220
        <name>groupingUsed</name>
220
            <name>groupingUsed</name>
221
        <required>false</required>
221
            <required>false</required>
222
        <rtexprvalue>true</rtexprvalue>
222
            <rtexprvalue>true</rtexprvalue>
223
    </attribute>
223
        </attribute>
224
    <attribute>
224
        <attribute>
225
        <name>maxIntegerDigits</name>
225
            <name>maxIntegerDigits</name>
226
        <required>false</required>
226
            <required>false</required>
227
        <rtexprvalue>true</rtexprvalue>
227
            <rtexprvalue>true</rtexprvalue>
228
    </attribute>
228
        </attribute>
229
    <attribute>
229
        <attribute>
230
        <name>minIntegerDigits</name>
230
            <name>minIntegerDigits</name>
231
        <required>false</required>
231
            <required>false</required>
232
        <rtexprvalue>true</rtexprvalue>
232
            <rtexprvalue>true</rtexprvalue>
233
    </attribute>
233
        </attribute>
234
    <attribute>
234
        <attribute>
235
        <name>maxFractionDigits</name>
235
            <name>maxFractionDigits</name>
236
        <required>false</required>
236
            <required>false</required>
237
        <rtexprvalue>true</rtexprvalue>
237
            <rtexprvalue>true</rtexprvalue>
238
    </attribute>
238
        </attribute>
239
    <attribute>
239
        <attribute>
240
        <name>minFractionDigits</name>
240
            <name>minFractionDigits</name>
241
        <required>false</required>
241
            <required>false</required>
242
        <rtexprvalue>true</rtexprvalue>
242
            <rtexprvalue>true</rtexprvalue>
243
    </attribute>
243
        </attribute>
244
    <attribute>
244
        <attribute>
245
        <name>var</name>
245
            <name>var</name>
246
        <required>false</required>
246
            <required>false</required>
247
        <rtexprvalue>false</rtexprvalue>
247
            <rtexprvalue>false</rtexprvalue>
248
    </attribute>
248
        </attribute>
249
    <attribute>
249
        <attribute>
250
        <name>scope</name>
250
            <name>scope</name>
251
        <required>false</required>
251
            <required>false</required>
252
        <rtexprvalue>false</rtexprvalue>
252
            <rtexprvalue>false</rtexprvalue>
253
    </attribute>
253
        </attribute>
254
  </tag>
254
    </tag>
255
255
256
  <tag>
256
    <tag>
257
    <name>parseNumber</name>
257
        <name>parseNumber</name>
258
    <tag-class>org.apache.taglibs.standard.tag.rt.fmt.ParseNumberTag</tag-class>
258
        <tag-class>org.apache.taglibs.standard.tag.rt.fmt.ParseNumberTag</tag-class>
259
    <body-content>JSP</body-content>
259
        <body-content>JSP</body-content>
260
    <description>
260
        <description>
261
        Parses the string representation of a number, currency, or percentage
261
            Parses the string representation of a number, currency, or percentage
262
    </description>
262
        </description>
263
    <attribute>
263
        <attribute>
264
        <name>value</name>
264
            <name>value</name>
265
        <required>false</required>
265
            <required>false</required>
266
        <rtexprvalue>true</rtexprvalue>
266
            <rtexprvalue>true</rtexprvalue>
267
    </attribute>
267
        </attribute>
268
    <attribute>
268
        <attribute>
269
        <name>type</name>
269
            <name>type</name>
270
        <required>false</required>
270
            <required>false</required>
271
        <rtexprvalue>true</rtexprvalue>
271
            <rtexprvalue>true</rtexprvalue>
272
    </attribute>
272
        </attribute>
273
    <attribute>
273
        <attribute>
274
        <name>pattern</name>
274
            <name>pattern</name>
275
        <required>false</required>
275
            <required>false</required>
276
        <rtexprvalue>true</rtexprvalue>
276
            <rtexprvalue>true</rtexprvalue>
277
    </attribute>
277
        </attribute>
278
    <attribute>
278
        <attribute>
279
        <name>parseLocale</name>
279
            <name>parseLocale</name>
280
        <required>false</required>
280
            <required>false</required>
281
        <rtexprvalue>true</rtexprvalue>
281
            <rtexprvalue>true</rtexprvalue>
282
    </attribute>
282
        </attribute>
283
    <attribute>
283
        <attribute>
284
        <name>integerOnly</name>
284
            <name>integerOnly</name>
285
        <required>false</required>
285
            <required>false</required>
286
        <rtexprvalue>true</rtexprvalue>
286
            <rtexprvalue>true</rtexprvalue>
287
    </attribute>
287
        </attribute>
288
    <attribute>
288
        <attribute>
289
        <name>var</name>
289
            <name>var</name>
290
        <required>false</required>
290
            <required>false</required>
291
        <rtexprvalue>false</rtexprvalue>
291
            <rtexprvalue>false</rtexprvalue>
292
    </attribute>
292
        </attribute>
293
    <attribute>
293
        <attribute>
294
        <name>scope</name>
294
            <name>scope</name>
295
        <required>false</required>
295
            <required>false</required>
296
        <rtexprvalue>false</rtexprvalue>
296
            <rtexprvalue>false</rtexprvalue>
297
    </attribute>
297
        </attribute>
298
  </tag>
298
    </tag>
299
299
300
  <tag>
300
    <tag>
301
    <name>formatDate</name>
301
        <name>formatDate</name>
302
    <tag-class>org.apache.taglibs.standard.tag.rt.fmt.FormatDateTag</tag-class>
302
        <tag-class>org.apache.taglibs.standard.tag.rt.fmt.FormatDateTag</tag-class>
303
    <body-content>empty</body-content>
303
        <body-content>empty</body-content>
304
    <description>
304
        <description>
305
        Formats a date and/or time using the supplied styles and pattern
305
            Formats a date and/or time using the supplied styles and pattern
306
    </description>
306
        </description>
307
    <attribute>
307
        <attribute>
308
        <name>value</name>
308
            <name>value</name>
309
        <required>true</required>
309
            <required>true</required>
310
        <rtexprvalue>true</rtexprvalue>
310
            <rtexprvalue>true</rtexprvalue>
311
    </attribute>
311
        </attribute>
312
    <attribute>
312
        <attribute>
313
        <name>type</name>
313
            <name>type</name>
314
        <required>false</required>
314
            <required>false</required>
315
        <rtexprvalue>true</rtexprvalue>
315
            <rtexprvalue>true</rtexprvalue>
316
    </attribute>
316
        </attribute>
317
    <attribute>
317
        <attribute>
318
        <name>dateStyle</name>
318
            <name>dateStyle</name>
319
        <required>false</required>
319
            <required>false</required>
320
        <rtexprvalue>true</rtexprvalue>
320
            <rtexprvalue>true</rtexprvalue>
321
    </attribute>
321
        </attribute>
322
    <attribute>
322
        <attribute>
323
        <name>timeStyle</name>
323
            <name>timeStyle</name>
324
        <required>false</required>
324
            <required>false</required>
325
        <rtexprvalue>true</rtexprvalue>
325
            <rtexprvalue>true</rtexprvalue>
326
    </attribute>
326
        </attribute>
327
    <attribute>
327
        <attribute>
328
        <name>pattern</name>
328
            <name>pattern</name>
329
        <required>false</required>
329
            <required>false</required>
330
        <rtexprvalue>true</rtexprvalue>
330
            <rtexprvalue>true</rtexprvalue>
331
    </attribute>
331
        </attribute>
332
    <attribute>
332
        <attribute>
333
        <name>timeZone</name>
333
            <name>timeZone</name>
334
        <required>false</required>
334
            <required>false</required>
335
        <rtexprvalue>true</rtexprvalue>
335
            <rtexprvalue>true</rtexprvalue>
336
    </attribute>
336
        </attribute>
337
    <attribute>
337
        <attribute>
338
        <name>var</name>
338
            <name>var</name>
339
        <required>false</required>
339
            <required>false</required>
340
        <rtexprvalue>false</rtexprvalue>
340
            <rtexprvalue>false</rtexprvalue>
341
    </attribute>
341
        </attribute>
342
    <attribute>
342
        <attribute>
343
        <name>scope</name>
343
            <name>scope</name>
344
        <required>false</required>
344
            <required>false</required>
345
        <rtexprvalue>false</rtexprvalue>
345
            <rtexprvalue>false</rtexprvalue>
346
    </attribute>
346
        </attribute>
347
  </tag>
347
    </tag>
348
348
349
  <tag>
349
    <tag>
350
    <name>parseDate</name>
350
        <name>parseDate</name>
351
    <tag-class>org.apache.taglibs.standard.tag.rt.fmt.ParseDateTag</tag-class>
351
        <tag-class>org.apache.taglibs.standard.tag.rt.fmt.ParseDateTag</tag-class>
352
    <body-content>JSP</body-content>
352
        <body-content>JSP</body-content>
353
    <description>
353
        <description>
354
        Parses the string representation of a date and/or time
354
            Parses the string representation of a date and/or time
355
    </description>
355
        </description>
356
    <attribute>
356
        <attribute>
357
        <name>value</name>
357
            <name>value</name>
358
        <required>false</required>
358
            <required>false</required>
359
        <rtexprvalue>true</rtexprvalue>
359
            <rtexprvalue>true</rtexprvalue>
360
    </attribute>
360
        </attribute>
361
    <attribute>
361
        <attribute>
362
        <name>type</name>
362
            <name>type</name>
363
        <required>false</required>
363
            <required>false</required>
364
        <rtexprvalue>true</rtexprvalue>
364
            <rtexprvalue>true</rtexprvalue>
365
    </attribute>
365
        </attribute>
366
    <attribute>
366
        <attribute>
367
        <name>dateStyle</name>
367
            <name>dateStyle</name>
368
        <required>false</required>
368
            <required>false</required>
369
        <rtexprvalue>true</rtexprvalue>
369
            <rtexprvalue>true</rtexprvalue>
370
    </attribute>
370
        </attribute>
371
    <attribute>
371
        <attribute>
372
        <name>timeStyle</name>
372
            <name>timeStyle</name>
373
        <required>false</required>
373
            <required>false</required>
374
        <rtexprvalue>true</rtexprvalue>
374
            <rtexprvalue>true</rtexprvalue>
375
    </attribute>
375
        </attribute>
376
    <attribute>
376
        <attribute>
377
        <name>pattern</name>
377
            <name>pattern</name>
378
        <required>false</required>
378
            <required>false</required>
379
        <rtexprvalue>true</rtexprvalue>
379
            <rtexprvalue>true</rtexprvalue>
380
    </attribute>
380
        </attribute>
381
    <attribute>
381
        <attribute>
382
        <name>timeZone</name>
382
            <name>timeZone</name>
383
        <required>false</required>
383
            <required>false</required>
384
        <rtexprvalue>true</rtexprvalue>
384
            <rtexprvalue>true</rtexprvalue>
385
    </attribute>
385
        </attribute>
386
    <attribute>
386
        <attribute>
387
        <name>parseLocale</name>
387
            <name>parseLocale</name>
388
        <required>false</required>
388
            <required>false</required>
389
        <rtexprvalue>true</rtexprvalue>
389
            <rtexprvalue>true</rtexprvalue>
390
    </attribute>
390
        </attribute>
391
    <attribute>
391
        <attribute>
392
        <name>var</name>
392
            <name>var</name>
393
        <required>false</required>
393
            <required>false</required>
394
        <rtexprvalue>false</rtexprvalue>
394
            <rtexprvalue>false</rtexprvalue>
395
    </attribute>
395
        </attribute>
396
    <attribute>
396
        <attribute>
397
        <name>scope</name>
397
            <name>scope</name>
398
        <required>false</required>
398
            <required>false</required>
399
        <rtexprvalue>false</rtexprvalue>
399
            <rtexprvalue>false</rtexprvalue>
400
    </attribute>
400
        </attribute>
401
  </tag>
401
    </tag>
402
402
403
</taglib>
403
</taglib>
(-)src/main/resources/META-INF/x.tld (-412 / +412 lines)
Lines 1-448 Link Here
1
<?xml version="1.0" encoding="UTF-8" ?>
1
<?xml version="1.0" encoding="UTF-8" ?>
2
2
3
<taglib xmlns="http://java.sun.com/xml/ns/j2ee"
3
<taglib xmlns="http://java.sun.com/xml/ns/j2ee"
4
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
5
        xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-jsptaglibrary_2_0.xsd"
6
    version="2.0">
6
        version="2.0">
7
    
8
  <description>JSTL 1.1 XML library</description>
9
  <display-name>JSTL XML</display-name>
10
  <tlib-version>1.1</tlib-version>
11
  <short-name>x</short-name>
12
  <uri>http://java.sun.com/jsp/jstl/xml</uri>
13
7
14
  <validator>
8
    <description>JSTL 1.1 XML library</description>
15
    <description>
9
    <display-name>JSTL XML</display-name>
16
        Provides validation features for JSTL XML tags.
10
    <tlib-version>1.1</tlib-version>
17
    </description>
11
    <short-name>x</short-name>
18
    <validator-class>
12
    <uri>http://java.sun.com/jsp/jstl/xml</uri>
19
	org.apache.taglibs.standard.tlv.JstlXmlTLV
20
    </validator-class>
21
  </validator>
22
13
23
  <tag>
14
    <validator>
24
    <description>
25
        Simple conditional tag that establishes a context for
26
        mutually exclusive conditional operations, marked by
27
        &lt;when&gt; and &lt;otherwise&gt;
28
    </description>
29
    <name>choose</name>
30
    <tag-class>org.apache.taglibs.standard.tag.common.core.ChooseTag</tag-class>
31
    <body-content>JSP</body-content>
32
  </tag>
33
34
  <tag>
35
    <description>
36
	Like &lt;%= ... &gt;, but for XPath expressions.
37
    </description>
38
    <name>out</name>
39
    <tag-class>org.apache.taglibs.standard.tag.rt.xml.ExprTag</tag-class>
40
    <body-content>empty</body-content>
41
    <attribute>
42
        <description>
15
        <description>
43
XPath expression to be evaluated.
16
            Provides validation features for JSTL XML tags.
44
        </description>
17
        </description>
45
        <name>select</name>
18
        <validator-class>
46
        <required>true</required>
19
            org.apache.taglibs.standard.tlv.JstlXmlTLV
47
        <rtexprvalue>false</rtexprvalue>
20
        </validator-class>
48
    </attribute>
21
    </validator>
49
    <attribute>
22
23
    <tag>
50
        <description>
24
        <description>
51
Determines whether characters &lt;,&gt;,&amp;,'," in the
25
            Simple conditional tag that establishes a context for
52
resulting string should be converted to their
26
            mutually exclusive conditional operations, marked by
53
corresponding character entity codes. Default
27
            &lt;when&gt; and &lt;otherwise&gt;
54
value is true.
55
        </description>
28
        </description>
56
        <name>escapeXml</name>
29
        <name>choose</name>
57
        <required>false</required>
30
        <tag-class>org.apache.taglibs.standard.tag.common.core.ChooseTag</tag-class>
58
        <rtexprvalue>true</rtexprvalue>
31
        <body-content>JSP</body-content>
59
    </attribute>
32
    </tag>
60
  </tag>
61
33
62
  <tag>
34
    <tag>
63
    <description>
64
        XML conditional tag, which evalutes its body if the
65
        supplied XPath expression evalutes to 'true' as a boolean
66
    </description>
67
    <name>if</name>
68
    <tag-class>org.apache.taglibs.standard.tag.common.xml.IfTag</tag-class>
69
    <body-content>JSP</body-content>
70
    <attribute>
71
        <description>
35
        <description>
72
The test condition that tells whether or not the
36
            Like &lt;%= ... &gt;, but for XPath expressions.
73
body content should be processed.
74
        </description>
37
        </description>
75
        <name>select</name>
38
        <name>out</name>
76
        <required>true</required>
39
        <tag-class>org.apache.taglibs.standard.tag.rt.xml.ExprTag</tag-class>
77
        <rtexprvalue>false</rtexprvalue>
40
        <body-content>empty</body-content>
78
    </attribute>
41
        <attribute>
79
    <attribute>
42
            <description>
43
                XPath expression to be evaluated.
44
            </description>
45
            <name>select</name>
46
            <required>true</required>
47
            <rtexprvalue>false</rtexprvalue>
48
        </attribute>
49
        <attribute>
50
            <description>
51
                Determines whether characters &lt;,&gt;,&amp;,'," in the
52
                resulting string should be converted to their
53
                corresponding character entity codes. Default
54
                value is true.
55
            </description>
56
            <name>escapeXml</name>
57
            <required>false</required>
58
            <rtexprvalue>true</rtexprvalue>
59
        </attribute>
60
    </tag>
61
62
    <tag>
80
        <description>
63
        <description>
81
Name of the exported scoped variable for the
64
            XML conditional tag, which evalutes its body if the
82
resulting value of the test condition. The type
65
            supplied XPath expression evalutes to 'true' as a boolean
83
of the scoped variable is Boolean.
84
        </description>
66
        </description>
85
        <name>var</name>
67
        <name>if</name>
86
        <required>false</required>
68
        <tag-class>org.apache.taglibs.standard.tag.common.xml.IfTag</tag-class>
87
        <rtexprvalue>false</rtexprvalue>
69
        <body-content>JSP</body-content>
88
    </attribute>
70
        <attribute>
89
    <attribute>
71
            <description>
72
                The test condition that tells whether or not the
73
                body content should be processed.
74
            </description>
75
            <name>select</name>
76
            <required>true</required>
77
            <rtexprvalue>false</rtexprvalue>
78
        </attribute>
79
        <attribute>
80
            <description>
81
                Name of the exported scoped variable for the
82
                resulting value of the test condition. The type
83
                of the scoped variable is Boolean.
84
            </description>
85
            <name>var</name>
86
            <required>false</required>
87
            <rtexprvalue>false</rtexprvalue>
88
        </attribute>
89
        <attribute>
90
            <description>
91
                Scope for var.
92
            </description>
93
            <name>scope</name>
94
            <required>false</required>
95
            <rtexprvalue>false</rtexprvalue>
96
        </attribute>
97
    </tag>
98
99
    <tag>
90
        <description>
100
        <description>
91
Scope for var.
101
            XML iteration tag.
92
        </description>
102
        </description>
93
        <name>scope</name>
103
        <name>forEach</name>
94
        <required>false</required>
104
        <tag-class>org.apache.taglibs.standard.tag.common.xml.ForEachTag</tag-class>
95
        <rtexprvalue>false</rtexprvalue>
105
        <body-content>JSP</body-content>
96
    </attribute>
106
        <attribute>
97
  </tag>
107
            <description>
108
                Name of the exported scoped variable for the
109
                current item of the iteration. This scoped variable
110
                has nested visibility. Its type depends on the
111
                result of the XPath expression in the select
112
                attribute.
113
            </description>
114
            <name>var</name>
115
            <required>false</required>
116
            <rtexprvalue>false</rtexprvalue>
117
        </attribute>
118
        <attribute>
119
            <description>
120
                XPath expression to be evaluated.
121
            </description>
122
            <name>select</name>
123
            <required>true</required>
124
            <rtexprvalue>false</rtexprvalue>
125
        </attribute>
126
        <attribute>
127
            <description>
128
                Iteration begins at the item located at the
129
                specified index. First item of the collection has
130
                index 0.
131
            </description>
132
            <name>begin</name>
133
            <required>false</required>
134
            <rtexprvalue>true</rtexprvalue>
135
            <type>int</type>
136
        </attribute>
137
        <attribute>
138
            <description>
139
                Iteration ends at the item located at the specified
140
                index (inclusive).
141
            </description>
142
            <name>end</name>
143
            <required>false</required>
144
            <rtexprvalue>true</rtexprvalue>
145
            <type>int</type>
146
        </attribute>
147
        <attribute>
148
            <description>
149
                Iteration will only process every step items of
150
                the collection, starting with the first one.
151
            </description>
152
            <name>step</name>
153
            <required>false</required>
154
            <rtexprvalue>true</rtexprvalue>
155
            <type>int</type>
156
        </attribute>
157
        <attribute>
158
            <description>
159
                Name of the exported scoped variable for the
160
                status of the iteration. Object exported is of type
161
                javax.servlet.jsp.jstl.core.LoopTagStatus. This scoped variable has nested visibility.
162
            </description>
163
            <name>varStatus</name>
164
            <required>false</required>
165
            <rtexprvalue>false</rtexprvalue>
166
        </attribute>
167
    </tag>
98
168
99
  <tag>
169
    <tag>
100
    <description>
101
	XML iteration tag.
102
    </description>
103
    <name>forEach</name>
104
    <tag-class>org.apache.taglibs.standard.tag.common.xml.ForEachTag</tag-class>
105
    <body-content>JSP</body-content>
106
    <attribute>
107
        <description>
170
        <description>
108
Name of the exported scoped variable for the
171
            Subtag of &lt;choose&gt; that follows &lt;when&gt; tags
109
current item of the iteration. This scoped variable
172
            and runs only if all of the prior conditions evaluated to
110
has nested visibility. Its type depends on the
173
            'false'
111
result of the XPath expression in the select
112
attribute.
113
        </description>
174
        </description>
114
	<name>var</name>
175
        <name>otherwise</name>
115
	<required>false</required>
176
        <tag-class>org.apache.taglibs.standard.tag.common.core.OtherwiseTag</tag-class>
116
	<rtexprvalue>false</rtexprvalue>
177
        <body-content>JSP</body-content>
117
    </attribute>
178
    </tag>
118
    <attribute>
119
        <description>
120
XPath expression to be evaluated.
121
        </description>
122
	<name>select</name>
123
	<required>true</required>
124
	<rtexprvalue>false</rtexprvalue>
125
    </attribute>
126
    <attribute>
127
        <description>
128
Iteration begins at the item located at the
129
specified index. First item of the collection has
130
index 0.
131
        </description>
132
	<name>begin</name>
133
	<required>false</required>
134
	<rtexprvalue>true</rtexprvalue>
135
	<type>int</type>
136
    </attribute>
137
    <attribute>
138
        <description>
139
Iteration ends at the item located at the specified
140
index (inclusive).
141
        </description>
142
	<name>end</name>
143
	<required>false</required>
144
	<rtexprvalue>true</rtexprvalue>
145
	<type>int</type>
146
    </attribute>
147
    <attribute>
148
        <description>
149
Iteration will only process every step items of
150
the collection, starting with the first one.
151
        </description>
152
	<name>step</name>
153
	<required>false</required>
154
	<rtexprvalue>true</rtexprvalue>
155
	<type>int</type>
156
    </attribute>
157
    <attribute>
158
        <description>
159
Name of the exported scoped variable for the
160
status of the iteration. Object exported is of type
161
javax.servlet.jsp.jstl.core.LoopTagStatus. This scoped variable has nested visibility.
162
        </description>
163
	<name>varStatus</name>
164
	<required>false</required>
165
	<rtexprvalue>false</rtexprvalue>
166
    </attribute>
167
  </tag>
168
179
169
  <tag>
180
    <tag>
170
    <description>
171
	Subtag of &lt;choose&gt; that follows &lt;when&gt; tags
172
	and runs only if all of the prior conditions evaluated to
173
	'false'
174
    </description>
175
    <name>otherwise</name>
176
    <tag-class>org.apache.taglibs.standard.tag.common.core.OtherwiseTag</tag-class>
177
    <body-content>JSP</body-content>
178
  </tag>
179
180
  <tag>
181
    <description>
182
        Adds a parameter to a containing 'transform' tag's Transformer
183
    </description>
184
    <name>param</name>
185
    <tag-class>org.apache.taglibs.standard.tag.rt.xml.ParamTag</tag-class>
186
    <body-content>JSP</body-content>
187
    <attribute>
188
        <description>
181
        <description>
189
Name of the transformation parameter.
182
            Adds a parameter to a containing 'transform' tag's Transformer
190
        </description>
183
        </description>
191
        <name>name</name>
184
        <name>param</name>
192
        <required>true</required>
185
        <tag-class>org.apache.taglibs.standard.tag.rt.xml.ParamTag</tag-class>
193
        <rtexprvalue>true</rtexprvalue>
186
        <body-content>JSP</body-content>
194
    </attribute>
187
        <attribute>
195
    <attribute>
188
            <description>
196
        <description>
189
                Name of the transformation parameter.
197
Value of the parameter.
190
            </description>
198
        </description>
191
            <name>name</name>
199
        <name>value</name>
192
            <required>true</required>
200
        <required>false</required>
193
            <rtexprvalue>true</rtexprvalue>
201
        <rtexprvalue>true</rtexprvalue>
194
        </attribute>
202
    </attribute>
195
        <attribute>
203
  </tag>
196
            <description>
197
                Value of the parameter.
198
            </description>
199
            <name>value</name>
200
            <required>false</required>
201
            <rtexprvalue>true</rtexprvalue>
202
        </attribute>
203
    </tag>
204
204
205
  <tag>
205
    <tag>
206
    <description>
207
	Parses XML content from 'source' attribute or 'body'
208
    </description>
209
    <name>parse</name>
210
    <tag-class>org.apache.taglibs.standard.tag.rt.xml.ParseTag</tag-class>
211
    <tei-class>org.apache.taglibs.standard.tei.XmlParseTEI</tei-class>
212
    <body-content>JSP</body-content>
213
    <attribute>
214
        <description>
206
        <description>
215
Name of the exported scoped variable for
207
            Parses XML content from 'source' attribute or 'body'
216
the parsed XML document. The type of the
217
scoped variable is implementation
218
dependent.
219
        </description>
208
        </description>
220
        <name>var</name>
209
        <name>parse</name>
221
        <required>false</required>
210
        <tag-class>org.apache.taglibs.standard.tag.rt.xml.ParseTag</tag-class>
222
        <rtexprvalue>false</rtexprvalue>
211
        <tei-class>org.apache.taglibs.standard.tei.XmlParseTEI</tei-class>
223
    </attribute>
212
        <body-content>JSP</body-content>
224
    <attribute>
213
        <attribute>
225
        <description>
214
            <description>
226
Name of the exported scoped variable for
215
                Name of the exported scoped variable for
227
the parsed XML document. The type of the
216
                the parsed XML document. The type of the
228
scoped variable is
217
                scoped variable is implementation
229
org.w3c.dom.Document.
218
                dependent.
230
        </description>
219
            </description>
231
        <name>varDom</name>
220
            <name>var</name>
232
        <required>false</required>
221
            <required>false</required>
233
        <rtexprvalue>false</rtexprvalue>
222
            <rtexprvalue>false</rtexprvalue>
234
    </attribute>
223
        </attribute>
235
    <attribute>
224
        <attribute>
236
        <description>
225
            <description>
237
Scope for var.
226
                Name of the exported scoped variable for
238
        </description>
227
                the parsed XML document. The type of the
239
        <name>scope</name>
228
                scoped variable is
240
        <required>false</required>
229
                org.w3c.dom.Document.
241
        <rtexprvalue>false</rtexprvalue>
230
            </description>
242
    </attribute>
231
            <name>varDom</name>
243
    <attribute>
232
            <required>false</required>
244
        <description>
233
            <rtexprvalue>false</rtexprvalue>
245
Scope for varDom.
234
        </attribute>
246
        </description>
235
        <attribute>
247
        <name>scopeDom</name>
236
            <description>
248
        <required>false</required>
237
                Scope for var.
249
        <rtexprvalue>false</rtexprvalue>
238
            </description>
250
    </attribute>
239
            <name>scope</name>
251
    <attribute>
240
            <required>false</required>
252
        <description>
241
            <rtexprvalue>false</rtexprvalue>
253
Deprecated. Use attribute 'doc' instead.
242
        </attribute>
254
        </description>
243
        <attribute>
255
        <name>xml</name>
244
            <description>
256
        <required>false</required>
245
                Scope for varDom.
257
        <rtexprvalue>true</rtexprvalue>
246
            </description>
258
    </attribute>
247
            <name>scopeDom</name>
259
    <attribute>
248
            <required>false</required>
260
        <description>
249
            <rtexprvalue>false</rtexprvalue>
261
Source XML document to be parsed.
250
        </attribute>
262
        </description>
251
        <attribute>
263
        <name>doc</name>
252
            <description>
264
        <required>false</required>
253
                Deprecated. Use attribute 'doc' instead.
265
        <rtexprvalue>true</rtexprvalue>
254
            </description>
266
    </attribute>
255
            <name>xml</name>
267
    <attribute>
256
            <required>false</required>
268
        <description>
257
            <rtexprvalue>true</rtexprvalue>
269
The system identifier (URI) for parsing the
258
        </attribute>
270
XML document.
259
        <attribute>
271
        </description>
260
            <description>
272
        <name>systemId</name>
261
                Source XML document to be parsed.
273
        <required>false</required>
262
            </description>
274
        <rtexprvalue>true</rtexprvalue>
263
            <name>doc</name>
275
    </attribute>
264
            <required>false</required>
276
    <attribute>
265
            <rtexprvalue>true</rtexprvalue>
277
        <description>
266
        </attribute>
278
Filter to be applied to the source
267
        <attribute>
279
document.
268
            <description>
280
        </description>
269
                The system identifier (URI) for parsing the
281
        <name>filter</name>
270
                XML document.
282
        <required>false</required>
271
            </description>
283
        <rtexprvalue>true</rtexprvalue>
272
            <name>systemId</name>
284
    </attribute>
273
            <required>false</required>
285
  </tag>
274
            <rtexprvalue>true</rtexprvalue>
275
        </attribute>
276
        <attribute>
277
            <description>
278
                Filter to be applied to the source
279
                document.
280
            </description>
281
            <name>filter</name>
282
            <required>false</required>
283
            <rtexprvalue>true</rtexprvalue>
284
        </attribute>
285
    </tag>
286
286
287
  <tag>
287
    <tag>
288
    <description>
289
	Saves the result of an XPath expression evaluation in a 'scope'
290
    </description>
291
    <name>set</name>
292
    <tag-class>org.apache.taglibs.standard.tag.common.xml.SetTag</tag-class>
293
    <body-content>empty</body-content>
294
    <attribute>
295
        <description>
288
        <description>
296
Name of the exported scoped variable to hold
289
            Saves the result of an XPath expression evaluation in a 'scope'
297
the value specified in the action. The type of the
298
scoped variable is whatever type the select
299
expression evaluates to.
300
        </description>
290
        </description>
301
        <name>var</name>
291
        <name>set</name>
302
        <required>true</required>
292
        <tag-class>org.apache.taglibs.standard.tag.common.xml.SetTag</tag-class>
303
        <rtexprvalue>false</rtexprvalue>
293
        <body-content>empty</body-content>
304
    </attribute>
294
        <attribute>
305
    <attribute>
295
            <description>
306
        <description>
296
                Name of the exported scoped variable to hold
307
XPath expression to be evaluated.
297
                the value specified in the action. The type of the
308
        </description>
298
                scoped variable is whatever type the select
309
	<name>select</name>
299
                expression evaluates to.
310
        <required>false</required>
300
            </description>
311
        <rtexprvalue>false</rtexprvalue>
301
            <name>var</name>
312
    </attribute>
302
            <required>true</required>
313
    <attribute>
303
            <rtexprvalue>false</rtexprvalue>
314
        <description>
304
        </attribute>
315
Scope for var.
305
        <attribute>
316
        </description>
306
            <description>
317
        <name>scope</name>
307
                XPath expression to be evaluated.
318
        <required>false</required>
308
            </description>
319
        <rtexprvalue>false</rtexprvalue>
309
            <name>select</name>
320
    </attribute>
310
            <required>false</required>
321
  </tag>
311
            <rtexprvalue>false</rtexprvalue>
312
        </attribute>
313
        <attribute>
314
            <description>
315
                Scope for var.
316
            </description>
317
            <name>scope</name>
318
            <required>false</required>
319
            <rtexprvalue>false</rtexprvalue>
320
        </attribute>
321
    </tag>
322
322
323
  <tag>
323
    <tag>
324
    <description>
325
	Conducts a transformation given a source XML document
326
	and an XSLT stylesheet
327
    </description>
328
    <name>transform</name>
329
    <tag-class>org.apache.taglibs.standard.tag.rt.xml.TransformTag</tag-class>
330
    <tei-class>org.apache.taglibs.standard.tei.XmlTransformTEI</tei-class>
331
    <body-content>JSP</body-content>
332
    <attribute>
333
        <description>
324
        <description>
334
Name of the exported
325
            Conducts a transformation given a source XML document
335
scoped variable for the
326
            and an XSLT stylesheet
336
transformed XML
337
document. The type of the
338
scoped variable is
339
org.w3c.dom.Document.
340
        </description>
327
        </description>
341
        <name>var</name>
328
        <name>transform</name>
342
        <required>false</required>
329
        <tag-class>org.apache.taglibs.standard.tag.rt.xml.TransformTag</tag-class>
343
        <rtexprvalue>false</rtexprvalue>
330
        <tei-class>org.apache.taglibs.standard.tei.XmlTransformTEI</tei-class>
344
    </attribute>
331
        <body-content>JSP</body-content>
345
    <attribute>
332
        <attribute>
346
        <description>
333
            <description>
347
Scope for var.
334
                Name of the exported
348
        </description>
335
                scoped variable for the
349
        <name>scope</name>
336
                transformed XML
350
        <required>false</required>
337
                document. The type of the
351
        <rtexprvalue>false</rtexprvalue>
338
                scoped variable is
352
    </attribute>
339
                org.w3c.dom.Document.
353
    <attribute>
340
            </description>
354
        <description>
341
            <name>var</name>
355
Result
342
            <required>false</required>
356
Object that captures or
343
            <rtexprvalue>false</rtexprvalue>
357
processes the transformation
344
        </attribute>
358
result.
345
        <attribute>
359
        </description>
346
            <description>
360
        <name>result</name>
347
                Scope for var.
361
        <required>false</required>
348
            </description>
362
        <rtexprvalue>true</rtexprvalue>
349
            <name>scope</name>
363
    </attribute>
350
            <required>false</required>
364
    <attribute>
351
            <rtexprvalue>false</rtexprvalue>
365
        <description>
352
        </attribute>
366
Deprecated. Use attribute
353
        <attribute>
367
'doc' instead.
354
            <description>
368
        </description>
355
                Result
369
        <name>xml</name>
356
                Object that captures or
370
        <required>false</required>
357
                processes the transformation
371
        <rtexprvalue>true</rtexprvalue>
358
                result.
372
    </attribute>
359
            </description>
373
    <attribute>
360
            <name>result</name>
374
        <description>
361
            <required>false</required>
375
Source XML document to be
362
            <rtexprvalue>true</rtexprvalue>
376
transformed. (If exported by
363
        </attribute>
377
&lt;x:set&gt;, it must correspond
364
        <attribute>
378
to a well-formed XML
365
            <description>
379
document, not a partial
366
                Deprecated. Use attribute
380
document.)
367
                'doc' instead.
381
        </description>
368
            </description>
382
        <name>doc</name>
369
            <name>xml</name>
383
        <required>false</required>
370
            <required>false</required>
384
        <rtexprvalue>true</rtexprvalue>
371
            <rtexprvalue>true</rtexprvalue>
385
    </attribute>
372
        </attribute>
386
    <attribute>
373
        <attribute>
387
        <description>
374
            <description>
388
Deprecated. Use attribute
375
                Source XML document to be
389
'docSystemId' instead.
376
                transformed. (If exported by
390
        </description>
377
                &lt;x:set&gt;, it must correspond
391
        <name>xmlSystemId</name>
378
                to a well-formed XML
392
        <required>false</required>
379
                document, not a partial
393
        <rtexprvalue>true</rtexprvalue>
380
                document.)
394
    </attribute>
381
            </description>
395
    <attribute>
382
            <name>doc</name>
396
        <description>
383
            <required>false</required>
397
The system identifier (URI)
384
            <rtexprvalue>true</rtexprvalue>
398
for parsing the XML
385
        </attribute>
399
document.
386
        <attribute>
400
        </description>
387
            <description>
401
        <name>docSystemId</name>
388
                Deprecated. Use attribute
402
        <required>false</required>
389
                'docSystemId' instead.
403
        <rtexprvalue>true</rtexprvalue>
390
            </description>
404
    </attribute>
391
            <name>xmlSystemId</name>
405
    <attribute>
392
            <required>false</required>
406
        <description>
393
            <rtexprvalue>true</rtexprvalue>
407
javax.xml.transform.Source
394
        </attribute>
408
Transformation stylesheet as
395
        <attribute>
409
a String, Reader, or
396
            <description>
410
Source object.
397
                The system identifier (URI)
411
        </description>
398
                for parsing the XML
412
	<name>xslt</name>
399
                document.
413
        <required>false</required>
400
            </description>
414
        <rtexprvalue>true</rtexprvalue>
401
            <name>docSystemId</name>
415
    </attribute>
402
            <required>false</required>
416
    <attribute>
403
            <rtexprvalue>true</rtexprvalue>
417
        <description>
404
        </attribute>
418
The system identifier (URI)
405
        <attribute>
419
for parsing the XSLT
406
            <description>
420
stylesheet.
407
                javax.xml.transform.Source
421
        </description>
408
                Transformation stylesheet as
422
	<name>xsltSystemId</name>
409
                a String, Reader, or
423
        <required>false</required>
410
                Source object.
424
        <rtexprvalue>true</rtexprvalue>
411
            </description>
425
    </attribute>
412
            <name>xslt</name>
426
  </tag>
413
            <required>false</required>
414
            <rtexprvalue>true</rtexprvalue>
415
        </attribute>
416
        <attribute>
417
            <description>
418
                The system identifier (URI)
419
                for parsing the XSLT
420
                stylesheet.
421
            </description>
422
            <name>xsltSystemId</name>
423
            <required>false</required>
424
            <rtexprvalue>true</rtexprvalue>
425
        </attribute>
426
    </tag>
427
427
428
  <tag>
428
    <tag>
429
    <description>
430
        Subtag of &lt;choose&gt; that includes its body if its
431
        expression evalutes to 'true'
432
    </description>
433
    <name>when</name>
434
    <tag-class>org.apache.taglibs.standard.tag.common.xml.WhenTag</tag-class>
435
    <body-content>JSP</body-content>
436
    <attribute>
437
        <description>
429
        <description>
438
The test condition that tells whether or
430
            Subtag of &lt;choose&gt; that includes its body if its
439
not the body content should be
431
            expression evalutes to 'true'
440
processed
441
        </description>
432
        </description>
442
        <name>select</name>
433
        <name>when</name>
443
        <required>true</required>
434
        <tag-class>org.apache.taglibs.standard.tag.common.xml.WhenTag</tag-class>
444
        <rtexprvalue>false</rtexprvalue>
435
        <body-content>JSP</body-content>
445
    </attribute>
436
        <attribute>
446
  </tag>
437
            <description>
438
                The test condition that tells whether or
439
                not the body content should be
440
                processed
441
            </description>
442
            <name>select</name>
443
            <required>true</required>
444
            <rtexprvalue>false</rtexprvalue>
445
        </attribute>
446
    </tag>
447
447
448
</taglib>
448
</taglib>
(-)src/main/resources/META-INF/x-1_0-rt.tld (-240 / +240 lines)
Lines 1-256 Link Here
1
<?xml version="1.0" encoding="ISO-8859-1" ?>
1
<?xml version="1.0" encoding="ISO-8859-1" ?>
2
<!DOCTYPE taglib
2
<!DOCTYPE taglib
3
  PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
3
        PUBLIC "-//Sun Microsystems, Inc.//DTD JSP Tag Library 1.2//EN"
4
  "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
4
        "http://java.sun.com/dtd/web-jsptaglibrary_1_2.dtd">
5
<taglib>
5
<taglib>
6
  <tlib-version>1.0</tlib-version>
6
    <tlib-version>1.0</tlib-version>
7
  <jsp-version>1.2</jsp-version>
7
    <jsp-version>1.2</jsp-version>
8
  <short-name>x_rt</short-name>
8
    <short-name>x_rt</short-name>
9
  <uri>http://java.sun.com/jstl/xml_rt</uri>
9
    <uri>http://java.sun.com/jstl/xml_rt</uri>
10
  <display-name>JSTL XML RT</display-name>
10
    <display-name>JSTL XML RT</display-name>
11
  <description>JSTL 1.0 XML library</description>
11
    <description>JSTL 1.0 XML library</description>
12
12
13
  <validator>
13
    <validator>
14
    <validator-class>
14
        <validator-class>
15
	org.apache.taglibs.standard.tlv.JstlXmlTLV
15
            org.apache.taglibs.standard.tlv.JstlXmlTLV
16
    </validator-class>
16
        </validator-class>
17
    <description>
17
        <description>
18
        Provides validation features for JSTL XML tags.
18
            Provides validation features for JSTL XML tags.
19
    </description>
19
        </description>
20
  </validator>
20
    </validator>
21
21
22
  <tag>
22
    <tag>
23
    <name>choose</name>
23
        <name>choose</name>
24
    <tag-class>org.apache.taglibs.standard.tag.common.core.ChooseTag</tag-class>
24
        <tag-class>org.apache.taglibs.standard.tag.common.core.ChooseTag</tag-class>
25
    <body-content>JSP</body-content>
25
        <body-content>JSP</body-content>
26
    <description>
26
        <description>
27
        Simple conditional tag that establishes a context for
27
            Simple conditional tag that establishes a context for
28
        mutually exclusive conditional operations, marked by
28
            mutually exclusive conditional operations, marked by
29
        &lt;when&gt; and &lt;otherwise&gt;
29
            &lt;when&gt; and &lt;otherwise&gt;
30
    </description>
30
        </description>
31
  </tag>
31
    </tag>
32
32
33
  <tag>
33
    <tag>
34
    <name>out</name>
34
        <name>out</name>
35
    <tag-class>org.apache.taglibs.standard.tag.rt.xml.ExprTag</tag-class>
35
        <tag-class>org.apache.taglibs.standard.tag.rt.xml.ExprTag</tag-class>
36
    <body-content>empty</body-content>
36
        <body-content>empty</body-content>
37
    <description>
37
        <description>
38
	Like &lt;%= ... &gt;, but for XPath expressions.
38
            Like &lt;%= ... &gt;, but for XPath expressions.
39
    </description>
39
        </description>
40
    <attribute>
40
        <attribute>
41
        <name>select</name>
41
            <name>select</name>
42
        <required>true</required>
42
            <required>true</required>
43
        <rtexprvalue>false</rtexprvalue>
43
            <rtexprvalue>false</rtexprvalue>
44
    </attribute>
44
        </attribute>
45
    <attribute>
45
        <attribute>
46
        <name>escapeXml</name>
46
            <name>escapeXml</name>
47
        <required>false</required>
47
            <required>false</required>
48
        <rtexprvalue>true</rtexprvalue>
48
            <rtexprvalue>true</rtexprvalue>
49
    </attribute>
49
        </attribute>
50
  </tag>
50
    </tag>
51
51
52
  <tag>
52
    <tag>
53
    <name>if</name>
53
        <name>if</name>
54
    <tag-class>org.apache.taglibs.standard.tag.common.xml.IfTag</tag-class>
54
        <tag-class>org.apache.taglibs.standard.tag.common.xml.IfTag</tag-class>
55
    <body-content>JSP</body-content>
55
        <body-content>JSP</body-content>
56
    <description>
56
        <description>
57
        XML conditional tag, which evalutes its body if the
57
            XML conditional tag, which evalutes its body if the
58
        supplied XPath expression evalutes to 'true' as a boolean
58
            supplied XPath expression evalutes to 'true' as a boolean
59
    </description>
59
        </description>
60
    <attribute>
60
        <attribute>
61
        <name>select</name>
61
            <name>select</name>
62
        <required>true</required>
62
            <required>true</required>
63
        <rtexprvalue>false</rtexprvalue>
63
            <rtexprvalue>false</rtexprvalue>
64
    </attribute>
64
        </attribute>
65
    <attribute>
65
        <attribute>
66
        <name>var</name>
66
            <name>var</name>
67
        <required>false</required>
67
            <required>false</required>
68
        <rtexprvalue>false</rtexprvalue>
68
            <rtexprvalue>false</rtexprvalue>
69
    </attribute>
69
        </attribute>
70
    <attribute>
70
        <attribute>
71
        <name>scope</name>
71
            <name>scope</name>
72
        <required>false</required>
72
            <required>false</required>
73
        <rtexprvalue>false</rtexprvalue>
73
            <rtexprvalue>false</rtexprvalue>
74
    </attribute>
74
        </attribute>
75
  </tag>
75
    </tag>
76
76
77
  <tag>
77
    <tag>
78
    <name>forEach</name>
78
        <name>forEach</name>
79
    <tag-class>org.apache.taglibs.standard.tag.common.xml.ForEachTag</tag-class>
79
        <tag-class>org.apache.taglibs.standard.tag.common.xml.ForEachTag</tag-class>
80
    <body-content>JSP</body-content>
80
        <body-content>JSP</body-content>
81
    <description>
81
        <description>
82
	XML iteration tag.
82
            XML iteration tag.
83
    </description>
83
        </description>
84
    <attribute>
84
        <attribute>
85
	<name>var</name>
85
            <name>var</name>
86
	<required>false</required>
86
            <required>false</required>
87
	<rtexprvalue>false</rtexprvalue>
87
            <rtexprvalue>false</rtexprvalue>
88
    </attribute>
88
        </attribute>
89
    <attribute>
89
        <attribute>
90
	<name>select</name>
90
            <name>select</name>
91
	<required>true</required>
91
            <required>true</required>
92
	<rtexprvalue>false</rtexprvalue>
92
            <rtexprvalue>false</rtexprvalue>
93
    </attribute>
93
        </attribute>
94
  </tag>
94
    </tag>
95
95
96
  <tag>
96
    <tag>
97
    <name>otherwise</name>
97
        <name>otherwise</name>
98
    <tag-class>org.apache.taglibs.standard.tag.common.core.OtherwiseTag</tag-class>
98
        <tag-class>org.apache.taglibs.standard.tag.common.core.OtherwiseTag</tag-class>
99
    <body-content>JSP</body-content>
99
        <body-content>JSP</body-content>
100
    <description>
100
        <description>
101
	Subtag of &lt;choose&gt; that follows &lt;when&gt; tags
101
            Subtag of &lt;choose&gt; that follows &lt;when&gt; tags
102
	and runs only if all of the prior conditions evaluated to
102
            and runs only if all of the prior conditions evaluated to
103
	'false'
103
            'false'
104
    </description>
104
        </description>
105
  </tag>
105
    </tag>
106
106
107
  <tag>
107
    <tag>
108
    <name>param</name>
108
        <name>param</name>
109
    <tag-class>org.apache.taglibs.standard.tag.rt.xml.ParamTag</tag-class>
109
        <tag-class>org.apache.taglibs.standard.tag.rt.xml.ParamTag</tag-class>
110
    <body-content>JSP</body-content>
110
        <body-content>JSP</body-content>
111
    <description>
111
        <description>
112
        Adds a parameter to a containing 'transform' tag's Transformer
112
            Adds a parameter to a containing 'transform' tag's Transformer
113
    </description>
113
        </description>
114
    <attribute>
114
        <attribute>
115
        <name>name</name>
115
            <name>name</name>
116
        <required>true</required>
116
            <required>true</required>
117
        <rtexprvalue>true</rtexprvalue>
117
            <rtexprvalue>true</rtexprvalue>
118
    </attribute>
118
        </attribute>
119
    <attribute>
119
        <attribute>
120
        <name>value</name>
120
            <name>value</name>
121
        <required>false</required>
121
            <required>false</required>
122
        <rtexprvalue>true</rtexprvalue>
122
            <rtexprvalue>true</rtexprvalue>
123
    </attribute>
123
        </attribute>
124
  </tag>
124
    </tag>
125
125
126
  <tag>
126
    <tag>
127
    <name>parse</name>
127
        <name>parse</name>
128
    <tag-class>org.apache.taglibs.standard.tag.rt.xml.ParseTag</tag-class>
128
        <tag-class>org.apache.taglibs.standard.tag.rt.xml.ParseTag</tag-class>
129
    <tei-class>org.apache.taglibs.standard.tei.XmlParseTEI</tei-class>
129
        <tei-class>org.apache.taglibs.standard.tei.XmlParseTEI</tei-class>
130
    <body-content>JSP</body-content>
130
        <body-content>JSP</body-content>
131
    <description>
131
        <description>
132
	Parses XML content from 'source' attribute or 'body'
132
            Parses XML content from 'source' attribute or 'body'
133
    </description>
133
        </description>
134
    <attribute>
134
        <attribute>
135
        <name>var</name>
135
            <name>var</name>
136
        <required>false</required>
136
            <required>false</required>
137
        <rtexprvalue>false</rtexprvalue>
137
            <rtexprvalue>false</rtexprvalue>
138
    </attribute>
138
        </attribute>
139
    <attribute>
139
        <attribute>
140
        <name>varDom</name>
140
            <name>varDom</name>
141
        <required>false</required>
141
            <required>false</required>
142
        <rtexprvalue>false</rtexprvalue>
142
            <rtexprvalue>false</rtexprvalue>
143
    </attribute>
143
        </attribute>
144
    <attribute>
144
        <attribute>
145
        <name>scope</name>
145
            <name>scope</name>
146
        <required>false</required>
146
            <required>false</required>
147
        <rtexprvalue>false</rtexprvalue>
147
            <rtexprvalue>false</rtexprvalue>
148
    </attribute>
148
        </attribute>
149
    <attribute>
149
        <attribute>
150
        <name>scopeDom</name>
150
            <name>scopeDom</name>
151
        <required>false</required>
151
            <required>false</required>
152
        <rtexprvalue>false</rtexprvalue>
152
            <rtexprvalue>false</rtexprvalue>
153
    </attribute>
153
        </attribute>
154
    <attribute>
154
        <attribute>
155
        <name>xml</name>
155
            <name>xml</name>
156
        <required>false</required>
156
            <required>false</required>
157
        <rtexprvalue>true</rtexprvalue>
157
            <rtexprvalue>true</rtexprvalue>
158
    </attribute>
158
        </attribute>
159
    <attribute>
159
        <attribute>
160
        <name>systemId</name>
160
            <name>systemId</name>
161
        <required>false</required>
161
            <required>false</required>
162
        <rtexprvalue>true</rtexprvalue>
162
            <rtexprvalue>true</rtexprvalue>
163
    </attribute>
163
        </attribute>
164
    <attribute>
164
        <attribute>
165
        <name>filter</name>
165
            <name>filter</name>
166
        <required>false</required>
166
            <required>false</required>
167
        <rtexprvalue>true</rtexprvalue>
167
            <rtexprvalue>true</rtexprvalue>
168
    </attribute>
168
        </attribute>
169
  </tag>
169
    </tag>
170
170
171
  <tag>
171
    <tag>
172
    <name>set</name>
172
        <name>set</name>
173
    <tag-class>org.apache.taglibs.standard.tag.common.xml.SetTag</tag-class>
173
        <tag-class>org.apache.taglibs.standard.tag.common.xml.SetTag</tag-class>
174
    <body-content>empty</body-content>
174
        <body-content>empty</body-content>
175
    <description>
175
        <description>
176
	Saves the result of an XPath expression evaluation in a 'scope'
176
            Saves the result of an XPath expression evaluation in a 'scope'
177
    </description>
177
        </description>
178
    <attribute>
178
        <attribute>
179
        <name>var</name>
179
            <name>var</name>
180
        <required>true</required>
180
            <required>true</required>
181
        <rtexprvalue>false</rtexprvalue>
181
            <rtexprvalue>false</rtexprvalue>
182
    </attribute>
182
        </attribute>
183
    <attribute>
183
        <attribute>
184
	<name>select</name>
184
            <name>select</name>
185
        <required>false</required>
185
            <required>false</required>
186
        <rtexprvalue>false</rtexprvalue>
186
            <rtexprvalue>false</rtexprvalue>
187
    </attribute>
187
        </attribute>
188
    <attribute>
188
        <attribute>
189
        <name>scope</name>
189
            <name>scope</name>
190
        <required>false</required>
190
            <required>false</required>
191
        <rtexprvalue>false</rtexprvalue>
191
            <rtexprvalue>false</rtexprvalue>
192
    </attribute>
192
        </attribute>
193
  </tag>
193
    </tag>
194
194
195
  <tag>
195
    <tag>
196
    <name>transform</name>
196
        <name>transform</name>
197
    <tag-class>org.apache.taglibs.standard.tag.rt.xml.TransformTag</tag-class>
197
        <tag-class>org.apache.taglibs.standard.tag.rt.xml.TransformTag</tag-class>
198
    <tei-class>org.apache.taglibs.standard.tei.XmlTransformTEI</tei-class>
198
        <tei-class>org.apache.taglibs.standard.tei.XmlTransformTEI</tei-class>
199
    <body-content>JSP</body-content>
199
        <body-content>JSP</body-content>
200
    <description>
200
        <description>
201
	Conducts a transformation given a source XML document
201
            Conducts a transformation given a source XML document
202
	and an XSLT stylesheet
202
            and an XSLT stylesheet
203
    </description>
203
        </description>
204
    <attribute>
204
        <attribute>
205
        <name>var</name>
205
            <name>var</name>
206
        <required>false</required>
206
            <required>false</required>
207
        <rtexprvalue>false</rtexprvalue>
207
            <rtexprvalue>false</rtexprvalue>
208
    </attribute>
208
        </attribute>
209
    <attribute>
209
        <attribute>
210
        <name>scope</name>
210
            <name>scope</name>
211
        <required>false</required>
211
            <required>false</required>
212
        <rtexprvalue>false</rtexprvalue>
212
            <rtexprvalue>false</rtexprvalue>
213
    </attribute>
213
        </attribute>
214
    <attribute>
214
        <attribute>
215
        <name>result</name>
215
            <name>result</name>
216
        <required>false</required>
216
            <required>false</required>
217
        <rtexprvalue>true</rtexprvalue>
217
            <rtexprvalue>true</rtexprvalue>
218
    </attribute>
218
        </attribute>
219
    <attribute>
219
        <attribute>
220
        <name>xml</name>
220
            <name>xml</name>
221
        <required>false</required>
221
            <required>false</required>
222
        <rtexprvalue>true</rtexprvalue>
222
            <rtexprvalue>true</rtexprvalue>
223
    </attribute>
223
        </attribute>
224
    <attribute>
224
        <attribute>
225
        <name>xmlSystemId</name>
225
            <name>xmlSystemId</name>
226
        <required>false</required>
226
            <required>false</required>
227
        <rtexprvalue>true</rtexprvalue>
227
            <rtexprvalue>true</rtexprvalue>
228
    </attribute>
228
        </attribute>
229
    <attribute>
229
        <attribute>
230
	<name>xslt</name>
230
            <name>xslt</name>
231
        <required>false</required>
231
            <required>false</required>
232
        <rtexprvalue>true</rtexprvalue>
232
            <rtexprvalue>true</rtexprvalue>
233
    </attribute>
233
        </attribute>
234
    <attribute>
234
        <attribute>
235
	<name>xsltSystemId</name>
235
            <name>xsltSystemId</name>
236
        <required>false</required>
236
            <required>false</required>
237
        <rtexprvalue>true</rtexprvalue>
237
            <rtexprvalue>true</rtexprvalue>
238
    </attribute>
238
        </attribute>
239
  </tag>
239
    </tag>
240
240
241
  <tag>
241
    <tag>
242
    <name>when</name>
242
        <name>when</name>
243
    <tag-class>org.apache.taglibs.standard.tag.common.xml.WhenTag</tag-class>
243
        <tag-class>org.apache.taglibs.standard.tag.common.xml.WhenTag</tag-class>
244
    <body-content>JSP</body-content>
244
        <body-content>JSP</body-content>
245
    <description>
245
        <description>
246
        Subtag of &lt;choose&gt; that includes its body if its
246
            Subtag of &lt;choose&gt; that includes its body if its
247
        expression evalutes to 'true'
247
            expression evalutes to 'true'
248
    </description>
248
        </description>
249
    <attribute>
249
        <attribute>
250
        <name>select</name>
250
            <name>select</name>
251
        <required>true</required>
251
            <required>true</required>
252
        <rtexprvalue>false</rtexprvalue>
252
            <rtexprvalue>false</rtexprvalue>
253
    </attribute>
253
        </attribute>
254
  </tag>
254
    </tag>
255
255
256
</taglib>
256
</taglib>
(-)pom.xml (-140 / +181 lines)
Lines 20-176 Link Here
20
    Enable Cactus tests
20
    Enable Cactus tests
21
-->
21
-->
22
<project
22
<project
23
    xmlns="http://maven.apache.org/POM/4.0.0"
23
        xmlns="http://maven.apache.org/POM/4.0.0"
24
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
24
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
25
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
25
        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
26
  <modelVersion>4.0.0</modelVersion>
26
    <modelVersion>4.0.0</modelVersion>
27
  <parent>
27
    <parent>
28
    <groupId>org.apache.taglibs</groupId>
28
        <groupId>org.apache.taglibs</groupId>
29
    <artifactId>taglibs-parent</artifactId>
29
        <artifactId>taglibs-parent</artifactId>
30
    <version>1-SNAPSHOT</version>
30
        <version>1-SNAPSHOT</version>
31
  </parent>
31
    </parent>
32
32
33
  <artifactId>taglibs-standard-impl</artifactId>
33
    <artifactId>taglibs-standard-impl</artifactId>
34
  <version>1.2-SNAPSHOT</version>
34
    <version>1.2-SNAPSHOT</version>
35
  <packaging>bundle</packaging>
35
    <packaging>bundle</packaging>
36
36
37
  <name>Apache Standard Taglib - JSTL Implementation</name>
37
    <name>Apache Standard Taglib - JSTL Implementation</name>
38
38
39
  <inceptionYear>2001</inceptionYear>
39
    <inceptionYear>2001</inceptionYear>
40
  <description>
40
    <description>
41
    An implementation of the JSP Standard Tag Library (JSTL).
41
        An implementation of the JSP Standard Tag Library (JSTL).
42
  </description>
42
    </description>
43
43
44
  <url>http://tomcat.apache.org/taglibs/standard/</url>
44
    <url>http://tomcat.apache.org/taglibs/standard/</url>
45
45
46
  <scm>
46
    <scm>
47
    <connection>scm:svn:http://svn.apache.org/repos/asf/tomcat/taglibs/standard/trunk/impl</connection>
47
        <connection>scm:svn:http://svn.apache.org/repos/asf/tomcat/taglibs/standard/trunk/impl</connection>
48
    <developerConnection>scm:svn:https://svn.apache.org/repos/asf/tomcat/taglibs/standard/trunk/impl</developerConnection>
48
        <developerConnection>scm:svn:https://svn.apache.org/repos/asf/tomcat/taglibs/standard/trunk/impl
49
    <url>http://svn.apache.org/viewvc/tomcat/taglibs/standard/trunk/impl</url>
49
        </developerConnection>
50
  </scm>
50
        <url>http://svn.apache.org/viewvc/tomcat/taglibs/standard/trunk/impl</url>
51
    </scm>
51
52
52
  <developers>
53
    <developers>
53
    <developer><name>Pierre Delisle</name></developer>
54
        <developer>
54
    <developer><name>Shawn Bayern</name></developer>
55
            <name>Pierre Delisle</name>
55
    <developer><name>Nathan Abramson</name></developer>
56
        </developer>
56
    <developer><name>Hans Bergsten</name></developer>
57
        <developer>
57
    <developer><name>Scott Hasse</name></developer>
58
            <name>Shawn Bayern</name>
58
    <developer><name>Justyna Horwat</name></developer>
59
        </developer>
59
    <developer><name>Mark Kolb</name></developer>
60
        <developer>
60
    <developer><name>Jan Luehe</name></developer>
61
            <name>Nathan Abramson</name>
61
    <developer><name>Glenn Nielsen</name></developer>
62
        </developer>
62
    <developer><name>Dmitri Plotnikov</name></developer>
63
        <developer>
63
    <developer><name>Felipe Leme</name></developer>
64
            <name>Hans Bergsten</name>
64
    <developer><name>Henri Yandell</name></developer>
65
        </developer>
65
    <developer><name>Bjorn Townsend</name></developer>
66
        <developer>
66
  </developers>
67
            <name>Scott Hasse</name>
68
        </developer>
69
        <developer>
70
            <name>Justyna Horwat</name>
71
        </developer>
72
        <developer>
73
            <name>Mark Kolb</name>
74
        </developer>
75
        <developer>
76
            <name>Jan Luehe</name>
77
        </developer>
78
        <developer>
79
            <name>Glenn Nielsen</name>
80
        </developer>
81
        <developer>
82
            <name>Dmitri Plotnikov</name>
83
        </developer>
84
        <developer>
85
            <name>Felipe Leme</name>
86
        </developer>
87
        <developer>
88
            <name>Henri Yandell</name>
89
        </developer>
90
        <developer>
91
            <name>Bjorn Townsend</name>
92
        </developer>
93
    </developers>
67
94
68
  <contributors>
95
    <contributors>
69
    <contributor><name>Robert Goff</name></contributor>
96
        <contributor>
70
  </contributors>
97
            <name>Robert Goff</name>
98
        </contributor>
99
    </contributors>
71
100
72
  <dependencies>
101
    <dependencies>
73
      <dependency>
102
        <dependency>
74
      <groupId>org.apache.taglibs</groupId>
103
            <groupId>org.apache.taglibs</groupId>
75
      <artifactId>taglibs-standard-spec</artifactId>
104
            <artifactId>taglibs-standard-spec</artifactId>
76
      <version>1.2-SNAPSHOT</version>
105
            <version>1.2-SNAPSHOT</version>
77
      <scope>provided</scope>
106
            <scope>provided</scope>
78
    </dependency>
107
        </dependency>
79
108
80
    <dependency>
109
        <dependency>
81
      <groupId>javax.servlet</groupId>
110
            <groupId>javax.servlet</groupId>
82
      <artifactId>servlet-api</artifactId>
111
            <artifactId>servlet-api</artifactId>
83
      <version>2.5</version>
112
            <version>2.5</version>
84
      <scope>provided</scope>
113
            <scope>provided</scope>
85
    </dependency>
114
        </dependency>
86
    <dependency>
115
        <dependency>
87
      <groupId>javax.servlet.jsp</groupId>
116
            <groupId>javax.servlet.jsp</groupId>
88
      <artifactId>jsp-api</artifactId>
117
            <artifactId>jsp-api</artifactId>
89
      <version>2.1</version>
118
            <version>2.1</version>
90
      <scope>provided</scope>
119
            <scope>provided</scope>
91
    </dependency>
120
        </dependency>
92
    <dependency>
121
        <dependency>
93
      <groupId>javax.el</groupId>
122
            <groupId>javax.el</groupId>
94
      <artifactId>el-api</artifactId>
123
            <artifactId>el-api</artifactId>
95
      <version>1.0</version>
124
            <version>1.0</version>
96
      <scope>provided</scope>
125
            <scope>provided</scope>
97
    </dependency>
126
        </dependency>
98
    <dependency>
127
        <dependency>
99
      <groupId>xalan</groupId>
128
            <groupId>xalan</groupId>
100
      <artifactId>xalan</artifactId>
129
            <artifactId>xalan</artifactId>
101
      <version>2.7.1</version>
130
            <version>2.7.1</version>
102
      <scope>provided</scope>
131
            <scope>provided</scope>
103
    </dependency>
132
        </dependency>
104
133
105
    <dependency>
134
        <dependency>
106
      <groupId>junit</groupId>
135
            <groupId>junit</groupId>
107
      <artifactId>junit</artifactId>
136
            <artifactId>junit</artifactId>
108
      <version>4.8.1</version>
137
            <version>4.8.1</version>
109
      <scope>test</scope>
138
            <scope>test</scope>
110
    </dependency>
139
        </dependency>
111
      <dependency>
140
        <dependency>
112
          <groupId>org.easymock</groupId>
141
            <groupId>org.easymock</groupId>
113
          <artifactId>easymock</artifactId>
142
            <artifactId>easymock</artifactId>
114
          <version>3.0</version>
143
            <version>3.0</version>
115
          <scope>test</scope>
144
            <scope>test</scope>
116
      </dependency>
145
        </dependency>
117
  </dependencies> 
146
    </dependencies>
118
147
119
  <build>
148
    <build>
120
    <plugins>
149
        <plugins>
121
      <plugin>
150
            <plugin>
122
        <groupId>org.apache.felix</groupId>
151
                <groupId>org.apache.felix</groupId>
123
        <artifactId>maven-bundle-plugin</artifactId>
152
                <artifactId>maven-bundle-plugin</artifactId>
124
        <configuration>
153
                <configuration>
125
          <excludeDependencies>true</excludeDependencies>
154
                    <excludeDependencies>true</excludeDependencies>
126
          <instructions>
155
                    <instructions>
127
            <Export-Package>*;version="1.2"</Export-Package>
156
                        <Export-Package>*;version="1.2"</Export-Package>
128
            <Import-Package>org.apache.x*;resolution:=optional,*</Import-Package>
157
                        <Import-Package>org.apache.x*;resolution:=optional,*</Import-Package>
129
          </instructions>
158
                    </instructions>
130
        </configuration>
159
                </configuration>
131
      </plugin>
160
            </plugin>
132
    </plugins>
161
        </plugins>
133
  </build>
162
    </build>
134
  
135
  <reporting>
136
    <plugins>
137
      <plugin>
138
        <artifactId>maven-pmd-plugin</artifactId>
139
        <version>2.3</version>
140
        <configuration>
141
          <targetJdk>${maven.compiler.target}</targetJdk>
142
        </configuration>
143
        <reportSets>
144
          <reportSet>
145
            <reports>
146
              <report>pmd</report>
147
              <report>cpd</report>
148
            </reports>
149
          </reportSet>
150
        </reportSets>
151
      </plugin>
152
      <plugin>
153
        <groupId>org.codehaus.mojo</groupId>
154
        <artifactId>taglist-maven-plugin</artifactId>
155
        <version>2.4</version>
156
      </plugin>
157
      <plugin>
158
        <groupId>org.codehaus.mojo</groupId>
159
        <artifactId>javancss-maven-plugin</artifactId>
160
        <version>2.0</version>
161
      </plugin>
162
      <plugin>
163
        <groupId>org.codehaus.mojo</groupId>
164
        <artifactId>findbugs-maven-plugin</artifactId>
165
        <version>1.2</version>
166
        <configuration>
167
          <threshold>Normal</threshold>
168
          <effort>Default</effort>
169
<!--          <excludeFilterFile>${basedir}/findbugs-exclude-filter.xml</excludeFilterFile> -->
170
       </configuration>
171
      </plugin>
172
    </plugins>
173
  </reporting>
174
163
164
    <reporting>
165
        <plugins>
166
            <plugin>
167
                <groupId>org.codehaus.mojo</groupId>
168
                <artifactId>jxr-maven-plugin</artifactId>
169
            </plugin>
170
            <plugin>
171
                <artifactId>maven-pmd-plugin</artifactId>
172
                <version>2.3</version>
173
                <configuration>
174
                    <targetJdk>${maven.compiler.target}</targetJdk>
175
                </configuration>
176
                <reportSets>
177
                    <reportSet>
178
                        <reports>
179
                            <report>pmd</report>
180
                            <report>cpd</report>
181
                        </reports>
182
                    </reportSet>
183
                </reportSets>
184
            </plugin>
185
            <plugin>
186
                <groupId>org.codehaus.mojo</groupId>
187
                <artifactId>taglist-maven-plugin</artifactId>
188
                <version>2.4</version>
189
            </plugin>
190
            <plugin>
191
                <groupId>org.codehaus.mojo</groupId>
192
                <artifactId>javancss-maven-plugin</artifactId>
193
                <version>2.0</version>
194
            </plugin>
195
            <plugin>
196
                <groupId>org.codehaus.mojo</groupId>
197
                <artifactId>findbugs-maven-plugin</artifactId>
198
                <version>1.2</version>
199
                <configuration>
200
                    <threshold>Normal</threshold>
201
                    <effort>Default</effort>
202
                    <!--          <excludeFilterFile>${basedir}/findbugs-exclude-filter.xml</excludeFilterFile> -->
203
                </configuration>
204
            </plugin>
205
            <plugin>
206
                <groupId>org.apache.maven.plugins</groupId>
207
                <artifactId>maven-checkstyle-plugin</artifactId>
208
                <version>2.6</version>
209
                <configuration>
210
                    <configLocation>checkstyle.xml</configLocation>
211
                </configuration>
212
            </plugin>
213
        </plugins>
214
    </reporting>
175
215
216
176
</project>
217
</project>

Return to bug 50279