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

(-)examples/src/org/apache/taglibs/standard/examples/i18n/Resources.java (-10 / +10 lines)
Lines 23-40 Link Here
23
    private static Object[][] contents;
23
    private static Object[][] contents;
24
24
25
    static {
25
    static {
26
	contents = new Object[][] {
26
        contents = new Object[][] {
27
	    { "greetingMorning", "Good Morning!" },
27
            { "greetingMorning", "Good Morning!" },
28
	    { "greetingEvening", "Good Evening!" },
28
            { "greetingEvening", "Good Evening!" },
29
	    { "serverInfo", "Name/Version of Servlet Container: {0}, "
29
            { "serverInfo", "Name/Version of Servlet Container: {0}, "
30
	                    + "Java Version: {1}" },
30
                            + "Java Version: {1}" },
31
	    { "currentTime", "Current time: {0}" },
31
            { "currentTime", "Current time: {0}" },
32
	    { "com.acme.labels.cancel", "Cancel" },
32
            { "com.acme.labels.cancel", "Cancel" },
33
	    { "java.lang.ArithmeticException", "division by 0" }
33
            { "java.lang.ArithmeticException", "division by 0" }
34
	};
34
        };
35
    }
35
    }
36
36
37
    public Object[][] getContents() {
37
    public Object[][] getContents() {
38
	return contents;
38
        return contents;
39
    }
39
    }
40
}
40
}
(-)examples/src/org/apache/taglibs/standard/examples/i18n/Resources_de.java (-10 / +10 lines)
Lines 23-40 Link Here
23
    private static Object[][] contents;
23
    private static Object[][] contents;
24
24
25
    static {
25
    static {
26
	contents = new Object[][] {
26
        contents = new Object[][] {
27
	    { "greetingMorning", "Guten Morgen!" },
27
            { "greetingMorning", "Guten Morgen!" },
28
	    { "greetingEvening", "Guten Abend!" },
28
            { "greetingEvening", "Guten Abend!" },
29
	    { "serverInfo", "Name/Version des Servlet Containers: {0}, "
29
            { "serverInfo", "Name/Version des Servlet Containers: {0}, "
30
	                    + "Java Version: {1}" },
30
                            + "Java Version: {1}" },
31
	    { "currentTime", "Heutiges Datum und Uhrzeit: {0}" },
31
            { "currentTime", "Heutiges Datum und Uhrzeit: {0}" },
32
	    { "com.acme.labels.cancel", "Abbrechen" },
32
            { "com.acme.labels.cancel", "Abbrechen" },
33
	    { "java.lang.ArithmeticException", "/ durch 0" }
33
            { "java.lang.ArithmeticException", "/ durch 0" }
34
	};
34
        };
35
    }
35
    }
36
36
37
    public Object[][] getContents() {
37
    public Object[][] getContents() {
38
	return contents;
38
        return contents;
39
    }
39
    }
40
}
40
}
(-)examples/src/org/apache/taglibs/standard/examples/i18n/Resources_fr.java (-10 / +10 lines)
Lines 23-40 Link Here
23
    private static Object[][] contents;
23
    private static Object[][] contents;
24
24
25
    static {
25
    static {
26
	contents = new Object[][] {
26
        contents = new Object[][] {
27
	    { "greetingMorning", "Bonjour!!" },
27
            { "greetingMorning", "Bonjour!!" },
28
	    { "greetingEvening", "Bonsoir!" },
28
            { "greetingEvening", "Bonsoir!" },
29
	    { "serverInfo", "Nom/Version du Servlet Container: {0}, "
29
            { "serverInfo", "Nom/Version du Servlet Container: {0}, "
30
	                    + "Version Java: {1}" },
30
                            + "Version Java: {1}" },
31
	    { "currentTime", "Nous sommes le: {0}" },
31
            { "currentTime", "Nous sommes le: {0}" },
32
	    { "com.acme.labels.cancel", "Annuler" },
32
            { "com.acme.labels.cancel", "Annuler" },
33
	    { "java.lang.ArithmeticException", "division par 0" }
33
            { "java.lang.ArithmeticException", "division par 0" }
34
	};
34
        };
35
    }
35
    }
36
36
37
    public Object[][] getContents() {
37
    public Object[][] getContents() {
38
	return contents;
38
        return contents;
39
    }
39
    }
40
}
40
}
(-)examples/src/org/apache/taglibs/standard/examples/i18n/Resources_it.java (-4 / +4 lines)
Lines 23-34 Link Here
23
    private static Object[][] contents;
23
    private static Object[][] contents;
24
24
25
    static {
25
    static {
26
	contents = new Object[][] {
26
        contents = new Object[][] {
27
	    { "greetingMorning", "Buon giorno!" }
27
            { "greetingMorning", "Buon giorno!" }
28
	};
28
        };
29
    }
29
    }
30
30
31
    public Object[][] getContents() {
31
    public Object[][] getContents() {
32
	return contents;
32
        return contents;
33
    }
33
    }
34
}
34
}
(-)examples/src/org/apache/taglibs/standard/examples/startup/Init.java (-41 / +41 lines)
Lines 71-93 Link Here
71
        "Toronto", "ON", "M5C 1Z1", "Canada");
71
        "Toronto", "ON", "M5C 1Z1", "Canada");
72
        sce.getServletContext().setAttribute("customers", Customers.findAll());
72
        sce.getServletContext().setAttribute("customers", Customers.findAll());
73
73
74
	/**
74
        /**
75
	 * Array of primitives (int)
75
         * Array of primitives (int)
76
	 */
76
         */
77
	int[] intArray = new int[] {10, 20, 30, 40, 50};
77
        int[] intArray = new int[] {10, 20, 30, 40, 50};
78
        sce.getServletContext().setAttribute("intArray", intArray);
78
        sce.getServletContext().setAttribute("intArray", intArray);
79
79
80
	/**
80
        /**
81
	 * Array of Objects (String)
81
         * Array of Objects (String)
82
	 */
82
         */
83
	String[] stringArray = new String[] {
83
        String[] stringArray = new String[] {
84
	    "A first string",
84
            "A first string",
85
	    "La deuxieme string",
85
            "La deuxieme string",
86
	    "Ella troisiemo stringo",
86
            "Ella troisiemo stringo",
87
	};
87
        };
88
        sce.getServletContext().setAttribute("stringArray", stringArray);
88
        sce.getServletContext().setAttribute("stringArray", stringArray);
89
89
90
	/**
90
        /**
91
        * String-keyed Map
91
        * String-keyed Map
92
        */
92
        */
93
        Hashtable stringMap = new Hashtable();
93
        Hashtable stringMap = new Hashtable();
Lines 105-142 Link Here
105
105
106
        /**
106
        /**
107
         * Integer-keyed Map
107
         * Integer-keyed Map
108
	 */
108
         */
109
	// we use a Hashtable so we can get an Enumeration easily, below
109
        // we use a Hashtable so we can get an Enumeration easily, below
110
        Hashtable numberMap = new Hashtable();
110
        Hashtable numberMap = new Hashtable();
111
	sce.getServletContext().setAttribute("numberMap", numberMap);
111
        sce.getServletContext().setAttribute("numberMap", numberMap);
112
	numberMap.put(new Integer(1), "uno");
112
        numberMap.put(new Integer(1), "uno");
113
	numberMap.put(new Integer(2), "dos");
113
        numberMap.put(new Integer(2), "dos");
114
	numberMap.put(new Integer(3), "tres");
114
        numberMap.put(new Integer(3), "tres");
115
	numberMap.put(new Integer(4), "cuatro");
115
        numberMap.put(new Integer(4), "cuatro");
116
	numberMap.put(new Integer(5), "cinco");
116
        numberMap.put(new Integer(5), "cinco");
117
	numberMap.put(new Integer(6), "seis");
117
        numberMap.put(new Integer(6), "seis");
118
	numberMap.put(new Integer(7), "siete");
118
        numberMap.put(new Integer(7), "siete");
119
	numberMap.put(new Integer(8), "ocho");
119
        numberMap.put(new Integer(8), "ocho");
120
	numberMap.put(new Integer(9), "nueve");
120
        numberMap.put(new Integer(9), "nueve");
121
	numberMap.put(new Integer(10), "diez");
121
        numberMap.put(new Integer(10), "diez");
122
122
123
	/**
123
        /**
124
	 * Enumeration
124
         * Enumeration
125
	 */
125
         */
126
	Enumeration enum_ = numberMap.keys();
126
        Enumeration enum_ = numberMap.keys();
127
	// don't use 'enum' for attribute name because it is a 
127
        // don't use 'enum' for attribute name because it is a 
128
	// reserved word in EcmaScript.
128
        // reserved word in EcmaScript.
129
        sce.getServletContext().setAttribute("enumeration", enum_);
129
        sce.getServletContext().setAttribute("enumeration", enum_);
130
130
131
	/**
131
        /**
132
	 * Message arguments for parametric replacement
132
         * Message arguments for parametric replacement
133
	 */
133
         */
134
	Object[] serverInfoArgs =
134
        Object[] serverInfoArgs =
135
	    new Object[] {
135
            new Object[] {
136
		sce.getServletContext().getServerInfo(),
136
                sce.getServletContext().getServerInfo(),
137
		System.getProperty("java.version")
137
                System.getProperty("java.version")
138
	    };
138
            };
139
	sce.getServletContext().setAttribute("serverInfoArgs", serverInfoArgs);
139
        sce.getServletContext().setAttribute("serverInfoArgs", serverInfoArgs);
140
    }
140
    }
141
    
141
    
142
    //*********************************************************************
142
    //*********************************************************************
(-)examples/src/org/apache/taglibs/standard/examples/taglib/LocalesTag.java (-9 / +9 lines)
Lines 34-63 Link Here
34
    private String varTotal;
34
    private String varTotal;
35
35
36
    public void setVarTotal( String value ) {
36
    public void setVarTotal( String value ) {
37
	varTotal = value;
37
        varTotal = value;
38
    }
38
    }
39
39
40
    public void prepare() {
40
    public void prepare() {
41
	pointer = 0;
41
        pointer = 0;
42
	if ( varTotal!=null && varTotal.length()>0 ) {
42
        if ( varTotal!=null && varTotal.length()>0 ) {
43
	    pageContext.setAttribute( varTotal, new Integer(locales.length) );
43
            pageContext.setAttribute( varTotal, new Integer(locales.length) );
44
	}
44
        }
45
    
45
    
46
    } 
46
    } 
47
47
48
    public boolean hasNext() {
48
    public boolean hasNext() {
49
	return pointer < locales.length;
49
        return pointer < locales.length;
50
    }  
50
    }  
51
51
52
    public Object next() {
52
    public Object next() {
53
	return locales[ pointer++ ];
53
        return locales[ pointer++ ];
54
    }
54
    }
55
  
55
  
56
    public void setBegin( int value ) {
56
    public void setBegin( int value ) {
57
  	super.begin = value;
57
          super.begin = value;
58
    }
58
    }
59
  
59
  
60
    public void setEnd( int value ) {
60
    public void setEnd( int value ) {
61
  	super.end = value;
61
          super.end = value;
62
    }                     
62
    }                     
63
}
63
}
(-)examples/src/org/apache/taglibs/standard/examples/taglib/NullAttributeException.java (-2 / +2 lines)
Lines 36-43 Link Here
36
     * @param att The attribute value for which the error occurred.
36
     * @param att The attribute value for which the error occurred.
37
     */
37
     */
38
    public NullAttributeException(String tag, String att) {
38
    public NullAttributeException(String tag, String att) {
39
	super("The '" + att + "' attribute illegally evaluated to 'null' "
39
        super("The '" + att + "' attribute illegally evaluated to 'null' "
40
	    + "in &lt;" + tag + "&gt;.");
40
            + "in &lt;" + tag + "&gt;.");
41
    }
41
    }
42
}
42
}
43
43
(-)examples/src/org/apache/taglibs/standard/examples/util/IOBean.java (-16 / +16 lines)
Lines 31-60 Link Here
31
    String content = null;
31
    String content = null;
32
32
33
    public Reader getReader() throws JspException {
33
    public Reader getReader() throws JspException {
34
	//p("getReader()");
34
        //p("getReader()");
35
	if (content == null) {
35
        if (content == null) {
36
	    if (stringWriter == null) {
36
            if (stringWriter == null) {
37
		throw new JspException(
37
                throw new JspException(
38
		    "content must first be added to the bean via the writer");
38
                    "content must first be added to the bean via the writer");
39
	    }
39
            }
40
	    content = stringWriter.toString();
40
            content = stringWriter.toString();
41
	}
41
        }
42
	return new StringReader(content);
42
        return new StringReader(content);
43
    }
43
    }
44
44
45
    public Writer getWriter() {
45
    public Writer getWriter() {
46
	//p("getWriter()");
46
        //p("getWriter()");
47
	content = null;
47
        content = null;
48
	stringWriter = new StringWriter();
48
        stringWriter = new StringWriter();
49
	return stringWriter;
49
        return stringWriter;
50
    }
50
    }
51
51
52
    public void release() {
52
    public void release() {
53
	stringWriter = null;
53
        stringWriter = null;
54
	content = null;
54
        content = null;
55
    }
55
    }
56
56
57
    private void p(String s) {
57
    private void p(String s) {
58
	System.out.println("[IOBean] " + s);
58
        System.out.println("[IOBean] " + s);
59
    }
59
    }
60
}
60
}
(-)examples/src/org/apache/taglibs/standard/examples/util/ServletResponseWrapperForWriter.java (-5 / +5 lines)
Lines 45-63 Link Here
45
    PrintWriter writer;
45
    PrintWriter writer;
46
46
47
    public ServletResponseWrapperForWriter(ServletResponse response, 
47
    public ServletResponseWrapperForWriter(ServletResponse response, 
48
					   PrintWriter writer) 
48
                                           PrintWriter writer) 
49
    {
49
    {
50
	super((HttpServletResponse)response);
50
        super((HttpServletResponse)response);
51
	this.writer = writer;
51
        this.writer = writer;
52
    }
52
    }
53
53
54
    /**
54
    /**
55
     * Returns the Writer associated with the response.
55
     * Returns the Writer associated with the response.
56
     */
56
     */
57
    public java.io.PrintWriter getWriter()
57
    public java.io.PrintWriter getWriter()
58
	throws java.io.IOException 
58
        throws java.io.IOException 
59
    {
59
    {
60
	return writer;
60
        return writer;
61
    }
61
    }
62
}
62
}
63
63
(-)examples/src/org/apache/taglibs/standard/examples/util/Util.java (-2 / +2 lines)
Lines 39-45 Link Here
39
             */
39
             */
40
        }
40
        }
41
        throw new JspException("Invalid type '" + obj.getClass().getName() +
41
        throw new JspException("Invalid type '" + obj.getClass().getName() +
42
			       "' for castToWriter()");
42
                               "' for castToWriter()");
43
    }
43
    }
44
    
44
    
45
    public static Reader castToReader(Object obj) throws JspException {
45
    public static Reader castToReader(Object obj) throws JspException {
Lines 51-57 Link Here
51
            return new StringReader((String)obj);
51
            return new StringReader((String)obj);
52
        }
52
        }
53
        throw new JspException("Invalid type '" + obj.getClass().getName() +
53
        throw new JspException("Invalid type '" + obj.getClass().getName() +
54
			       "' for castToReader()");
54
                               "' for castToReader()");
55
    }
55
    }
56
}
56
}
57
57

Return to bug 50279