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]