Ah, I guess I misunderstood your previous post. Maybe this will help you
along?

<snip>
Use the formatKey attribute if you want to pull it from message resources.
Have
a look at java.text.DecimalFormat for an explanation of formatting patterns
for
decimal numbers.
</snip>

The above code came from http://www.junlu.com/msg/45833.html. I didn't even
know that this was possible. Lets see if I need it some day!


Andreas

-----Ursprungliche Nachricht-----
Von: Kumar M [mailto:[EMAIL PROTECTED]
Gesendet: Donnerstag, 11. Marz 2004 17:30
An: Struts Users Mailing List
Betreff: Re: AW: bean:message format ssn



Thanks for your replies.

There seems to be a way to format using <bean:message>. If you look at
the following article from Ted Husted:

http://www.jguru.com/faq/view.jsp?EID=915891

 From the article:

"ordering.authorized.range.staff=Staff is only authorized to requisition
supplies that cost less than ${0,number} USD"

would convert argument 0 to the number format. Isn't that nice!

I was wondering if there is anyway we could extend this for things like
ssn. I am looking at the MessageFormat class and all but was wondering
if some one has come across this already.

Thanks!


[EMAIL PROTECTED] wrote:

>Hi Kumar,
>
>when you look at the documentation for bean:write
>(http://jakarta.apache.org/struts/userGuide/struts-bean.html#write) you can
>find that it allows formating. Bean:message looks like it does not support
>this feature - which kind of makes sense when you consider what its used
for
>(lookup of strings in the resources -> supporting parameterized
>replacement).
>
>The format of the format string is something like
>
><snip>
>  -  <tr>
>  -   <td><%= pageContext.getAttribute("test7.value") %></td>
>  -    <td>[#,000.00] <bean:write name="test7.value"
>format="#,000.00"/></td>
>  -    <td>[<bean:message key="format.pattern" />] <bean:write
>name="test7.value"
>formatKey="format.pattern"/></td>
>  -  </tr>
></snip>
>
>The preceeding code came from
>http://www.mail-archive.com/[EMAIL PROTECTED]/msg20743.html
>
>Andreas
>
>-----Ursprungliche Nachricht-----
>Von: Kumar M [mailto:[EMAIL PROTECTED]
>Gesendet: Donnerstag, 11. Marz 2004 16:45
>An: Struts Users Mailing List
>Betreff: bean:message format ssn
>
>
>
>Hi all,
>
>I am wondering if there is an easy way to format the ssnn. What I have
>is a String '123456789' but the users would like to see '123-45-6789'.
>Is there an easy way of doing this using bean:write or bean:message or
>any other tag?
>
>Thanks!!
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>


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

Reply via email to