JSF Best Practices: Dealing with phone numbers

I am sure this would be benefitial to everyone so... I was wondering what would be the best practice to show/edit/search phone numbers in JSF-based UI? I guess it all depends on the table/attribute definition? Suppose in your table you have
COUNTRY_CODE
AREA_CODE
PHONE (xxx-xxxx)
EXT
how would you design the 'most' user friendly UI? Is there any component with 'pre-built' phone mask?

Hello,
It's funny since I got the same question today in a meeting.
I would write a PhoneNumber and PhoneNumberConverter class. The getAsString would simply returns the (xxx) xxx-xxxx format, the getAsObject method would check to string value against a regex, probably something like: \s*((\(\d{3}\))|(\d{3}\s*-))?\s*(\d{3})\s*-?\s*(\d{4})
That way the user will always see the format xxx-xxxx but will able to enter all those formats:
xxx-xxx-xxxx
xxx - xxx - xxxx
(xxx)xxx-xxxx
(xxx) xxx-xxxx
xxx-xxxx
xxx - xxxx
Regards,
Simon Lessard
Message was edited by:
Simon Lessard

Similar Messages

  • Best practice dealing with mixed footage types

    I will soon embark on my first proper FCP project. The film will be shot at the end of the week on a Sony PMW-EX1 in 1080p25. We already shot some footage a few weeks ago, alas this was mistakenly shot interlaced 1080i50. What would be the best way to go about combining these two sets of footage? Should I de-interlace the 1080i50 stuff first or just drop it all into the timeline and allow FCP to deal with it?

    OK, I found a better solution.Future<String> errString = executorService.submit(
        new Callable<String>() {
            public String call() throws Exception {
                StringWriter errWriter = new StringWriter();
                IOUtil.copy(process.getErrorStream(), errWriter, "UTF-8");
                return errWriter.toString();
    int exitValue = process.waitFor();
    getLog().info("exitValue = " + exitValue);
    try {
        getLog().info("errString =\n" + errString.get());
    } catch (ExecutionException e) {
        throw new MojoExecutionException("proxygen: ExecutionException");
    } The problem I was having before seemed to be that the call to Apache's IOUtil.copy(errorStream, errWriter, "UTF-8"); was not working right, it did not seem to be terminating on EOS. But now it seems to be working fine, so I must have been chasing some other problem (or non-problem).
    So, it does seem the best thing to do is read the error and output streams from the process on their own daemon threads, and then call process.waitFor(). The ExecutorService API makes this easy, and using a Callable to return a future value does the right thing. Also, Callable is a little nicer as the call method can throw an Exception, so my code does not need to worry about that (and the readability is better).
    Thanks for helping to clarify my thoughts and finding a good solution :-)
    Now, it would be really nice if the Process API had a method like process.getFutureErrorString() which does what my code does.
    Cheers, Eric

  • What is the best practice dealing with process.getErrorStream()

    I've been playing around creating Process objects with ProcessBuilder. I can use getErrorStream() and getOutputStream() to read the output from the process, but it seems I have to do this on another thread. If I simply call process.waitFor() and then try to read the streams that doesn't work. So I do something like final InputStream errorStream = process.getErrorStream();
    final StringWriter errWriter = new StringWriter();
    ExecutorService executorService = Executors.newCachedThreadPool();
    executorService.execute(
        new Runnable() {
            public void run() {
                try {
                    IOUtils.copy(errorStream, errWriter, "UTF-8");
             } catch (IOException e) {
                    getLog().error(e.getMessage(), e);
    int exitValue = process.waitFor();
    getLog().info("exitValue = " + exitValue);
    getLog().info("errString =\n" + errWriter); This works, but it seems rather inelegant somehow.
    The basic problem is that the Runnable never completes on its own. Through experimentation, I believe that when the process is actually done, errorStream is never closed, or never gets an end-of-file. My current code works because when it goes to read errWriter it just reads what is currently in the buffer. However, if I wanted to clean things up and use executorService.submit() to submit a Callable and get back a Future, then a lot more code is needed because "IOUtils.copy(errorStream, errWriter, "UTF-8");" never terminates.
    Am I misunderstanding something, or is process.getErrorStream() just a crappy API?
    What do other people do when they want to get the error and output results from running a process?
    Edited by: Eric Kolotyluk on Aug 16, 2012 5:26 PM

    OK, I found a better solution.Future<String> errString = executorService.submit(
        new Callable<String>() {
            public String call() throws Exception {
                StringWriter errWriter = new StringWriter();
                IOUtil.copy(process.getErrorStream(), errWriter, "UTF-8");
                return errWriter.toString();
    int exitValue = process.waitFor();
    getLog().info("exitValue = " + exitValue);
    try {
        getLog().info("errString =\n" + errString.get());
    } catch (ExecutionException e) {
        throw new MojoExecutionException("proxygen: ExecutionException");
    } The problem I was having before seemed to be that the call to Apache's IOUtil.copy(errorStream, errWriter, "UTF-8"); was not working right, it did not seem to be terminating on EOS. But now it seems to be working fine, so I must have been chasing some other problem (or non-problem).
    So, it does seem the best thing to do is read the error and output streams from the process on their own daemon threads, and then call process.waitFor(). The ExecutorService API makes this easy, and using a Callable to return a future value does the right thing. Also, Callable is a little nicer as the call method can throw an Exception, so my code does not need to worry about that (and the readability is better).
    Thanks for helping to clarify my thoughts and finding a good solution :-)
    Now, it would be really nice if the Process API had a method like process.getFutureErrorString() which does what my code does.
    Cheers, Eric

  • What is best way dealing with large tiff file in OSX Lion?

    I'm working with large tiff  file (engineering drawing), but preview couldnt handle (unresponsive) this situation.
    What is best way dealing with large tiff file in OSX Lion? (Viewing only or simple editing)
    Thx,
    54n9471

    Use an iPad and this app http://itunes.apple.com/WebObjects/MZStore.woa/wa/viewSoftware?id=400600005&mt=8

  • Viewing addresses (with phone numbers) in Mail

    Is it possible to view addresses with phone numbers by selecting the address button/icon in the toolbar in Mail? All I see are the email addresses and it would be convenient to see the phone numbers as well...
    Any advice...thanks.
    cj

    Not a way I know to do this now. As for what is coming in the future, there is no way to know unless Apple announces.

  • JSF - Best Practice For Using Managed Bean

    I want to discuss what is the best practice for managed bean usage, especially using session scope or request scope to build database driven pages
    ---- Session Bean ----
    - In the book Core Java Server Faces, the author mentioned that most of the cases session bean should be used, unless the processing is passed on to other handler. Since JSF can store the state on client side, i think storing everything in session is not a big memory concern. (can some expert confirm this is true?) Session objects are easy to manage and states can be shared across the pages. It can make programming easy.
    In the case of a page binded to a resultset, the bean usually helds a java.util.List object for the result, which is intialized in the constructor by query the database first. However, this approach has a problem: when user navigates to other page and comes back, the data is not refreshed. You can of course solve the problem by issuing query everytime in your getXXX method. But you need to be very careful that you don't bind this XXX property too many times. In the case of querying in getXXX, setXXX is also tricky as you don't have a member to set. You usually don't want to persist the resultset changes in the setXXX as the changes may not be final, in stead, you want to handle in the actionlistener (like a save(actionevent)).
    I would glad to see your thought on this.
    --- Request Bean ---
    request bean is initialized everytime a reuqest is made. It sometimes drove me nuts because JSF seems not to be every consistent in updating model values. Suppose you have a page showing parent-children a list of records from database, and you also allow user to change directly on the children. if I hbind the parent to a bean called #{Parent} and you bind the children to ADF table (value="#{Parent.children}" var="rowValue". If I set Parent as a request scope, the setChildren method is never called when I submit the form. Not sure if this is just for ADF or it is JSF problem. But if you change the bean to session scope, everything works fine.
    I believe JSF doesn't update the bindings for all component attributes. It only update the input component value binding. Some one please verify this is true.
    In many cases, i found request bean is very hard to work with if there are lots of updates. (I have lots of trouble with update the binding value for rendered attributes).
    However, request bean is working fine for read only pages and simple binded forms. It definitely frees up memory quicker than session bean.
    ----- any comments or opinions are welcome!!! ------

    I think it should be either Option 2 or Option 3.
    Option 2 would be necessary if the bean data depends on some request parameters.
    (Example: Getting customer bean for a particular customer id)
    Otherwise Option 3 seems the reasonable approach.
    But, I am also pondering on this issue. The above are just my initial thoughts.

  • Skype associated with phone numbers

    How do I turn off the feature that identifies all phone numbers in emails, etc as Skype numbers with the blue Skype logo and blue font?

    Hi, rdanpurnell,
    My next step would be to  check if Click to Call is "on."  If you can not right-click on the blue S in your browser, and turn off C2C, included here are how to uninstall this plug-in:
    https://support.skype.com/en/faq/FA657/how-do-i-use-skype-click-to-call
    Best regards,
    Elaine
    Was your question answered? Please click on the Accept as a Solution link so everyone can quickly find what works! Like a post or want to say, "Thank You" - ?? Click on the Kudos button!
    Trustworthy information: Brian Krebs: 3 Basic Rules for Online Safety and Consumer Reports: Guide to Internet Security Online Safety Tip: Change your passwords often!

  • TS3398 I have lost my contacts that were entered into my iphone in addition to those that are synced from my exchange account. Iphone is only showing email addresses, no contacts with phone numbers.

    Two days ago my phone locked up and when I could access again, my contact list was only a few names and email addresses.  ALL phone numbers wiped from the phone.  I have been using google sync for three years to sync contact and calendar to gmail and then sync gmail to iphone, and it has been seemless.  I would think this was the problem, however the contacts and phone numbers that were added directly the phone are no longer on the phone either....which point to a phone problem.
    I went home, to update but ended up having to "restore" from backup, which I did.  The contacts were visible for less than 24 hours, but then disappeared again the next day.  I have tried forums for google sync as that would solve a large amount of the contacts, but I still can't seem to find a solution for the other contacts added directly to the phone.
    are there any new glitches/issues with the iOS 6 that cause this problem?
    phone is 3GS.
    thanks.

    Do the numbers still exist in your google contacts?
    Google recently terminated support for new configurations of gmail using Exchange Active Sync for unpaid accounts. In theory, existing configurations will continue to work, but there have been some problem reports.
    I've seen several mentions of the problem you describe in the last few days and so far, they've gone unresolved as far as I can tell. The root cause may be in google's termination of AES support.
    Facebook contact sync may also be a suspect.

  • JSF best practice for managed bean population

    hi;
    consider a simple session scope managed bean with 1 attribute which is calculated dynamically.
    there seem to be 3 ways of populating that attribute (that i could think of):
    1. have the bean's get<attribute> get the data and populate it
    2. have the constructor of the bean get the data and populate it
    3. have an action get the data, and set it from the action code (maybe use a valueBinding to get the bean if the bean which needs population is not the same bean that holds the action) .
    option 1 seems ok for situations where i need my data to be calculated for every valueRef for that attribute but is an overhead for data that need not be calculated for every valueRef.
    option 2 will ensure that te data is calculated only once per session. but it still looks kinda strange to do it
    with option 3, it seems you should populate the dynamic content of the next page and its intuitive but some places in the page might be common content with dynamic data and this has nothing to do with navigation and the next page to be displayed.
    is there a best practice of how to populate a managed bean data?
    are different cases fit different ways?
    any thoughts are appriciated.

    I think it should be either Option 2 or Option 3.
    Option 2 would be necessary if the bean data depends on some request parameters.
    (Example: Getting customer bean for a particular customer id)
    Otherwise Option 3 seems the reasonable approach.
    But, I am also pondering on this issue. The above are just my initial thoughts.

  • Any way to get rid of email contacts mixed in with phone numbers?

    Hi. My email contacts and phone numbers are mixed together and I want just my phone numbers to show. This is found by tapping the green phone icon and going to contacts.

    Hi,
    Actually you can do this. Place your email only contacts in a separate group.
    your phone contacts should be in their own group as well.
    just leave the contacts list in the phone app showing only the phone contacts group.
    you will see a groups button in the upper left corner of the contacts screen.

  • SAP Best Practice Integrated with Solution manager

    We have a server in which we installed SAP Best practice baseline package and we have the solution manager 7.01 SP 25
    We maintained the logical port but when we try to check connectivity to solution manager we got the following error:
    Connectivity check to sap solution manager system not successful
    Message no. /SMB/BB_INSTALLER375
    Can anyone guide us how to solve the problem and also if there is another way to upload the solution defined on the best practice solution builder into sap solution manager as a template project
    Thanks,
    Heba Hesham

    Hi,
    Patches for SAPGUI 7.10 can be found at the following location:
    http://service.sap.com/patches
    -> Entry by Application Group -> SAP Frontend Components
    -> SAP GUI FOR WINDOWS -> SAP GUI FOR WINDOWS 7.10 CORE
    -> SAP GUI FOR WINDOWS 7.10 CORE -> Win 32
    -> gui710_2-10002995.exe

  • SAP Best Practice: Problems with Loading of Transaction Data

    Hi!
    I am about to implement SAP Best Practices scenario "B34: Accounts Receivable Analysis".
    Therefore I load the data from SAP ERP IDES system into SAP NetWeaver 2004s system.
    My problems are:
    when I try to load the Transaction data for Infosources 0FI_AR_4 and 0FI_AR_6 I get the following errors/warnings:
    when I start the "schedule process" the status getting still "yellow 14:27: 31(194 from 0 records)"
    On the right side I see some actions that are also "yellow", e.g. "DataStore Activation (Change Lo ): not yet activated".
    As a result I cannot see any data in tcode "RSRT" executing the queries "0FIAR_C03/...".
    The problems there
    1) Input help of the web template of query don't contain any values
    2) no data will be shown
    Can some one help me to solve this problem?
    Thank you very much!
    Jürgen

    Be in the monitor window where u got the below issue
    when I start the "schedule process" the status getting still "yellow 14:27: 31(194 from 0 records)"
    and go to environment in the menu options TransactRFC--->in the sourcesystem...
    give the logon details and enter and from there give the correct target destination as ur BI server and execute...
    if u find some idoc's pending there push that manually using F6..
    and come back to ur load and refresh....
    if still it doen't turn green u can manully change status to red in STATUS tab and come to processing tab and expand ur processing details and right click on ur data packet which was not yet updated and select manual update...
    it shows busy status and when it comes out of that once again refresh...
    rgds,

  • Requesting guidance on how best to deal with removal of CreateElementSteps for tables when option to 'script validation for new constraints' is enabled during schema compare

    I have a DeploymentPlanModifer subclass that is responsible for removing certain tables from a deployment plan under specific conditions. It is relatively trivial to find the
    CreateElementSteps I need and subsequently remove them via
    DeploymentPlanModifier.Remove(), but...
    ... if in my comparison I have enabled the 'Script validation for new constraints' option, the deployment plan will contain a
    DeploymentScriptDomStep with a Batch containing AlterTableConstraintModificationStatements for tables with foreign key constraints. My problem starts here - there will be an orphaned
    AlterTableConstraintModificationStatement for each of the tables that I removed. Obviously, execution of the generated script comes to a grinding halt when asking SQL Server to to alter a table that is never created.
    I'm able to get around this by digging around in the aforementioned batches and removing the orphaned alter statements, but this seems really hacky, which makes me think I'm missing the proper way of dealing with this.
    So... if anyone is aware of a more correct way of avoiding this problem, I would really appreciate finding out more about it.
    Thanks in advance for any help. :-)

    Hi Greg. Unfortunately there is not an easy solution here. Walking the deployment model, spotting potential issues and excluding them really is what you have as an option here. The alternative is to pre-process the dacpac to have it in the form you want,
    but I'm not sure if this is an option in your case and it also has limitations.
    Regards,
    Kevin

  • Are phone contacts with phone numbers automatically backed up

    Are phone contacts including phone numbers automatically backed up in icloud?

    Yes, but restoring them from a backup can be difficult and isn't officially supported by Apple.  To make sure you have them backed up, use an app like My Contacts Backup on your phone to back them up as a vCard attachment to an email.  Send the email to yourself an save the attachment.  If you ever need to restore them you can email the attachment back to your phone and tap the attachment to restore them to your phone.

  • Dealing with two numbers at one contact is a problem

    I managed to backup and transfer anything I want from my iphone 4 to my PC without syncing or using internet connection. All by usb cable. But the one thing that I can not manage any more is my CONTACTS. Iws trying to compy my contacts to other Nokia phone. I use 2 or more numbers for one contact. For example
    First Name: Sean
    Mobile: 011111111111
    Mobile: 02222222222
    Other: 03333333333
    I synced with Windows Contacts and Outlook but always the data (contacts) on my PC shows one Mobile and Other so in my example it will show like this
    First Name: Sean
    Mobile: 011111111111
    Other: 03333333333
    So is there any way to backup/sync my all contacts with full info even custom labels ?
    This is my first question so excuse me if I did anything wrong by posting it

    innesco wrote:
    This is partial solution thank you Michael Black but it didn't work when I used more than one Custom Label for example
    First Name: Sean
    Mobile: 011111111111
    CustomLabel1: 02222222222
    CustomLabel2: 03333333333
    and the result in outlook is
    First Name: Sean
    Mobile: 011111111111
    Other: 03333333333
    Any ideas ?
    In my Outlook 2007, the phone number fields are specifically defined in the predefined dropdown list.  I see no option to use anything but those in that dropdown list, so I'd say you must make sure that each phone number field you set up on your iPhone contacts matchs, exactly, one of those in the Outlook allowed field names.  Being a typical MS program, you must rigidly use their assigned field names

Maybe you are looking for

  • Service Tax Registration Number

    hi all, Where can i incorporate the Vendor's Service Tax Registration number in the Vendor Master. I am working in CIN - Country India Version. I can see a column in the table J_1IMOVEND, Service tax regn. no. How does it get populated. thnx regards

  • Deploying EJB

    Hi there. I am getting error WSVR0209E. It looks like i need to deploy my session bean in RAD7. I have Enterprise Bean containing MDB and my Session Bean, when I restarted the server i am getting the error above. I've been searching how to deploy my

  • Flex 4.6: ios pdf viewer app

    Hello flexers, I want to know if there will be a problem if i develop an ipad app for a magazine that can view pdf of the issue which containt links, videos and other object. Thanks in advance. Moez

  • What the Hell is Application Server 10g R2

    Hello Experts....I am using Application Server 10g R2 on Windows Server 2003..In the Morning Everything(Especially Reports) Works fine...but in Evening i think it the Report Server get tired...it take too much time to run even simple Report..What the

  • Exam 1Z0-007 and questions from Controlling User Access

    Hi, I am preparing for exam 1Z0-007 and going to give this exam in two weeks. I like to confirm if "Controlling User Access" topic is part of this exam 1Z0-007? I have checked on Oracle website and this topic is not a part if this exam anymore unless