That shouldn't be any different than 
<bean:message key="submit.price" arg0="1234.56"/>

I forgot to mention the exception occuring with that
statement. It looks like the magic happening in the
java.text.* classes with a {0,number,currency}
argument requires a java.lang.Number.

org.apache.jasper.JasperException: Cannot format given
Object as a Number
        at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:248)
        at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:289)


<...etc...>

root cause

java.lang.IllegalArgumentException: Cannot format
given Object as a Number
        at
java.text.NumberFormat.format(NumberFormat.java:204)
        at java.text.Format.format(Format.java:116)
        at
java.text.MessageFormat.format(MessageFormat.java:737)
        at
java.text.MessageFormat.format(MessageFormat.java:486)
        at java.text.Format.format(Format.java:116)

--- James Mitchell <[EMAIL PROTECTED]> wrote:
> > it won't compile, its expecting a
> java.lang.String:
> 
> try this...
> 
>  <bean:message key="submit.price"
>                arg0="<%= new
> Double("1234.56").toString() %>"/>
> 
> 
> 
> --
> James Mitchell
> Software Engineer/Struts Evangelist
> http://www.open-tools.org
> 
> "If you were plowing a field, which would you rather
> use? Two strong oxen or
> 1024 chickens?"
> - Seymour Cray (1925-1996), father of supercomputing
> 
> 
> > -----Original Message-----
> > From: Joshua McCulloch
> [mailto:[EMAIL PROTECTED]]
> > Sent: Friday, November 22, 2002 2:43 PM
> > To: [EMAIL PROTECTED]
> > Subject: i18n, resource bundles,
> <bean:message/>...
> >
> >
> > Can someone please help me understand how to use
> > arguments for <bean:message/> ?
> >
> > I have an ApplicationResource with the following
> > message:
> >
> > submit.price=It costs {0,number,currency}!
> >
> > How can I display that from a JSP? The following
> > doesnt work because arg0 is a String.
> > <bean:message key="submit.price" arg0="1234.56"/>
> >
> > I havent used JSP tags much.
> > http://husted.com/struts/tips/004.html shows the
> > following syntax: <bean:message
> > key="ordering.authorized.range.staff" arg0='<%=
> > config.getStaffAuthAmnt() %>'/>
> > I tried arg0="<%= new Double("1234.56") %>" and it
> > wont compile, its expecting a java.lang.String:
> >
> >
>
C:\tomcat\work\Standalone\localhost\josh\submit_jsp.java:134:
> > setArg0(java.lang.String) in
> > org.apache.struts.taglib.bean.MessageTag cannot be
> > applied to (java.lang.Double)
> >           _jspx_th_bean_message_11.setArg0( new
> > Double("1234.56") );
> >
> > What am I doing wrong?
> >
> > THANKS!
> > - Josh
> >
> >


__________________________________________________
Do you Yahoo!?
Yahoo! Mail Plus – Powerful. Affordable. Sign up now.
http://mailplus.yahoo.com

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

Reply via email to