Bean Write formatKey/Bundle problem

2005-01-06 Thread Tommy Holm - TELMORE
Hi everybody.
I have a problem with the bean:write tag. I have a jsp page with the
following text bean:write name=websmsForm property=smsMessagesPrice
bundle=FormatResources  formatKey=currency.format / and I have
create two ressource bundles FormatResources.properties and
FormatResources_da.properties. The idea here is that there is a defualt
bundle that holds the currencyformat for the smsMessagesPrice property
and there is a specific danish version(the page is hosted in Denmark).
Everything works as expected in the following conditions. 1.) The user
has a browser with the language set to english. 2.) The user has a
browser with no language preference. 3.) The user has a browser with the
danish language set.
THE PROBLEM.
If a user has a browser with dutch language set or any other language,
an error occurs. Error = Wrong format string: '#.##0,00 kr'.''. It seems
as if the tag finds a locale that it has no bundle for, then it tries to
use the danish format which is failing for dutch. 
Why doesn't the tag just simply use the default english ?
Cheers


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



SV: formatting of strings

2005-01-06 Thread Tommy Holm - TELMORE
Hi 
It's actually very simple.
bean:write name=address property=telephoneno
format=###-###-#/
A better solution would be to create a ressource bundle - lets say
TelephoneFormatResources.properties and create an entry in that file-
something like
format1=###-###-

The use the bundle instead

bean:write name=address property=telephoneno
bundle=TelephoneFormatResources formatKey=###-###-#/

It will then take the format from the bundle instead of the jsp page
directly. The advantage is that if you change the format, then you just
have to change it one place, instead of changing the format in all jsp
pages!
Cheers
-Oprindelig meddelelse-
Fra: Krishna Mohan Radhakrishnan [mailto:[EMAIL PROTECTED] 
Sendt: 6. januar 2005 09:08
Til: Struts Users Mailing List
Emne: formatting of strings

Hi all,

I have a class called address. I want to display the the telephone
number from it.
The below mentioned is the code. But from the address class we will
retrieve it as 10 digit string.

bean:write name=address property=telephoneno/

For example if  9845612345 is the number I want to display it as
follows.
984-561-2345

Is there any idea of how to format the string in this fashion

Regards,
Krishna Mohan R


-
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]