Re: formatting of strings
Krishna, what's the class of your telefoneno property? The format attribute is used only if the value to be displayed is NOT instance of java.lang.String. Pavel On Thu, 6 Jan 2005 18:56:23 +0530, Krishna Mohan Radhakrishnan [EMAIL PROTECTED] wrote: Sorry Tommy, The thing that u said simple didn't not work out.. Do u have any other ideas. Are u sure that it is # only. Or is it any other character.. INFOSYS TECHNOLOGIES LIMITED 3rd Floor | Bhavani Technopark | Trivandrum 695 581 | India Phone +91 471 2700888 Extn 7365 | Mobile: +919895532610 [EMAIL PROTECTED]| www.infosys.com -Original Message- From: Tommy Holm - TELMORE [mailto:[EMAIL PROTECTED] Sent: Thursday, January 06, 2005 2:59 PM To: Struts Users Mailing List Subject: SV: formatting of strings 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] - 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]
RE: formatting of strings
HI Pavell, The class of telefoneno is String. Can we do a similar type of formatting using String. Any ideas? INFOSYS TECHNOLOGIES LIMITED 3rd Floor | Bhavani Technopark | Trivandrum 695 581 | India Phone +91 471 2700888 Extn 7365 | Mobile: +919895532610 [EMAIL PROTECTED]| www.infosys.com -Original Message- From: Pavel Kolesnikov [mailto:[EMAIL PROTECTED] Sent: Friday, January 07, 2005 4:19 PM To: Struts Users Mailing List Subject: Re: formatting of strings Krishna, what's the class of your telefoneno property? The format attribute is used only if the value to be displayed is NOT instance of java.lang.String. Pavel On Thu, 6 Jan 2005 18:56:23 +0530, Krishna Mohan Radhakrishnan [EMAIL PROTECTED] wrote: Sorry Tommy, The thing that u said simple didn't not work out.. Do u have any other ideas. Are u sure that it is # only. Or is it any other character.. INFOSYS TECHNOLOGIES LIMITED 3rd Floor | Bhavani Technopark | Trivandrum 695 581 | India Phone +91 471 2700888 Extn 7365 | Mobile: +919895532610 [EMAIL PROTECTED]| www.infosys.com -Original Message- From: Tommy Holm - TELMORE [mailto:[EMAIL PROTECTED] Sent: Thursday, January 06, 2005 2:59 PM To: Struts Users Mailing List Subject: SV: formatting of strings 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] - 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]
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]
SV: formatting of strings
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]
Re: formatting of strings
On Thu, 6 Jan 2005 13:37:47 +0530, Krishna Mohan Radhakrishnan [EMAIL PROTECTED] wrote: 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 What about using StringBuffer.insert()? :) You can put in your own tag, you can extend your address bean by adding a tefonenoFormatted property, you can put a scriptlet in you JSP (the most simple and ugly way ;) or you can create a custom EL function (requires JSP 2.0). And I believe there's a lot of other ways. Pavel - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: formatting of strings
Sorry Tommy, The thing that u said simple didn't not work out.. Do u have any other ideas. Are u sure that it is # only. Or is it any other character.. INFOSYS TECHNOLOGIES LIMITED 3rd Floor | Bhavani Technopark | Trivandrum 695 581 | India Phone +91 471 2700888 Extn 7365 | Mobile: +919895532610 [EMAIL PROTECTED]| www.infosys.com -Original Message- From: Tommy Holm - TELMORE [mailto:[EMAIL PROTECTED] Sent: Thursday, January 06, 2005 2:59 PM To: Struts Users Mailing List Subject: SV: formatting of strings 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] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: formatting of strings
Are you sure it's not formatKey=format1 instead of formatKey=###-##-? For example: bean:write name=address property=telephoneno bundle=TelephoneFormatResources formatKey=format1/ (assuming the bundle exists, has the key format1 which has the value ###-##-) instead of: bean:write name=address property=telephoneno bundle=TelephoneFormatResources formatKey=###-###-#/ Makes more sense to me . . . Erik Krishna Mohan Radhakrishnan wrote: Sorry Tommy, The thing that u said simple didn't not work out.. Do u have any other ideas. Are u sure that it is # only. Or is it any other character.. INFOSYS TECHNOLOGIES LIMITED 3rd Floor | Bhavani Technopark | Trivandrum 695 581 | India Phone +91 471 2700888 Extn 7365 | Mobile: +919895532610 [EMAIL PROTECTED]| www.infosys.com -Original Message- From: Tommy Holm - TELMORE [mailto:[EMAIL PROTECTED] Sent: Thursday, January 06, 2005 2:59 PM To: Struts Users Mailing List Subject: SV: formatting of strings 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] - 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]
RE: formatting of strings
No erik, I didn't use any format key bundles as such. I used the format property and not formatKey. I don't know how to create a bundle called TelephoneFormatResources bean:write name=address property=telephoneno format=###-###-#/ This is how I used the bean. Regards Krishna Mohan R -Original Message- From: Erik Weber [mailto:[EMAIL PROTECTED] Sent: Friday, January 07, 2005 7:24 AM To: Struts Users Mailing List Subject: Re: formatting of strings Are you sure it's not formatKey=format1 instead of formatKey=###-##-? For example: bean:write name=address property=telephoneno bundle=TelephoneFormatResources formatKey=format1/ (assuming the bundle exists, has the key format1 which has the value ###-##-) instead of: bean:write name=address property=telephoneno bundle=TelephoneFormatResources formatKey=###-###-#/ Makes more sense to me . . . Erik Krishna Mohan Radhakrishnan wrote: Sorry Tommy, The thing that u said simple didn't not work out.. Do u have any other ideas. Are u sure that it is # only. Or is it any other character.. INFOSYS TECHNOLOGIES LIMITED 3rd Floor | Bhavani Technopark | Trivandrum 695 581 | India Phone +91 471 2700888 Extn 7365 | Mobile: +919895532610 [EMAIL PROTECTED]| www.infosys.com -Original Message- From: Tommy Holm - TELMORE [mailto:[EMAIL PROTECTED] Sent: Thursday, January 06, 2005 2:59 PM To: Struts Users Mailing List Subject: SV: formatting of strings 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] - 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]