I am trying to use the Message tag to handle the display of plural vs.
singular. I tried the following simple example but it does not work as
ChoiceFormat requires a Number but MessageTag's argN are of type String.

> jsp:

<% for (int i = 0; i < 5; i++) { %>
<bean:message key="test1" arg0="<%= String.valueOf(i) %>"/>
<% } %>

> application resources:

test1=There {0,choice,0#are no files|1#is one file|2#are {0,number,integer}
files}.

> error:

java.lang.IllegalArgumentException: Cannot format given Object as a Number
        at java.text.NumberFormat.format(NumberFormat.java:209)
        at java.text.Format.format(Format.java:121)
        at java.text.MessageFormat.format(MessageFormat.java:742)
        at java.text.MessageFormat.format(MessageFormat.java:491)
        at java.text.Format.format(Format.java:121)
        at
org.apache.struts.util.MessageResources.getMessage(MessageResources.java:325
)
        at org.apache.struts.util.RequestUtils.message(RequestUtils.java:586)
        at org.apache.struts.taglib.bean.MessageTag.doStartTag(MessageTag.java:239)


Has anyone found a workaround for this, or is there another way to do it?

Thanks in advance,

Fabien

---------------------------------------------
Fabien Modoux,
Voicemate - http://www.voicemate.com


--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to