You are building a web application that requires significant internationalization requirements. You have been tasked to create a custom tag that generates a message using the java.text.MessageFormat class.
The tag will take the messageKey attribute and a variable number of argument attributes with the format, arg.
Here is an example use of this tag and its output:
<tag:message messageKey='welcome' arg0='Brian' arg1='Christopher' />
Output : Welcome Brian Christopher ! |
Which Simple tag class definition accomplishes this goal of handling a variable number of tag attributes? |
Choice 1 |
public class I18Tag extends SimpleTagSupport
implements VariableAttributes {
private Map attributes = new HashMap();
public void setVariableAttribute(String uri,
String name, Object value) {
this.attributes.put(name, value);
}
// more tag handler methods
}
|
Choice 2 |
public classI18Tag extends SimpleTagSupport
implements DynamicAttributes {
private Map attributes = new HashMap();
public void setDynamicAttribute(String uri, String name,
Object value) {
this.attributes.put(name, value);
}
// more tag handler methods
}
|
Choice 3 |
public class I18Tagextends SimpleTagSupport
implements DynamicAttributes {
private Map attributes = new HashMap();
public void putAttribute(String name, Object value) {
this.attributes.put(name, value);
}
// more tag handler methods
}
|
Choice 4 |
public class I18Tagextends SimpleTagSupport
implements VariableAttributes {
private Map attributes = new HashMap();
public void putAttribute(String name, Object value) {
this.attributes.put(name, value);
}
// more tag handler methods
}
|