[ http://issues.apache.org/struts/browse/STR-1280?page=all ] David Evans reopened STR-1280: ------------------------------
Assign To: (was: Struts Developer Mailing List) > bean:message could be more power with little effort > --------------------------------------------------- > > Key: STR-1280 > URL: http://issues.apache.org/struts/browse/STR-1280 > Project: Struts Action 1 > Type: Improvement > Components: Taglibs > Versions: 1.1 RC1 > Environment: Operating System: All > Platform: All > Reporter: William A. McArthur, Jr > Priority: Minor > > A lot of power in the bean:message taglib is lost because the setters/getters > for the arg0 though arg4 take java.lang.String arguments instead of > java.lang.Object. This is because it makes it impossible to pass a subclass of > java.lang.Number as one of the arguments. > For example if in my app's Message.properties I have the property: > how.many.messages={0,choice,0#No messages|1#One message|1<Lots of messages} > and I use the bean:message taglib in the following way: > <bean:message key="how.many.messages" arg0="<%= "12" %>"/> > The java.text.ChoiceFormat fails in the method > java.text.NumberFormat.format(Object,StringBuffer,FieldPosition) with a > "java.lang.IllegalArgumentException: Cannot format given Object as a Number" > because "12" is a string and not a subclass of Number. > If I use the bean:message taglib in the following way: > <bean:message key="how.many.messages" arg0="<%= new Integer(12) %>"/> > The JSP fails to compile because there is no way to cast an Integer to a > String. > I really wish it wasn't so but I understand it's probably too late in the game > to get this change made by Struts 1.1. It would be nice that if in the > documentation a note is added mentioning that the bean:message taglib only > allows only very simplistic parametric replacement so people like myself don't > assume we have access to the full power of java.text.MessageFormat and waste a > few hours trying to figure out why things are breaking. -- This message is automatically generated by JIRA. - If you think it was sent incorrectly contact one of the administrators: http://issues.apache.org/struts/secure/Administrators.jspa - For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]