How to make custom  validator in jsf

hi
i am using jsf for web designing in my projects.now we are using java script for JSF validation .but i am interested to do validation using validator tag of JSF.i have tried ,but it is not working.what can i do for this problem.can u give some simple examples with clear explanations.
My validator class file is
package com.obs.ftw.util.validation;
public class isEmpty implements Validator{
     public isEmpty(){}
     public void validate(FacesContext context, UIComponent uiComponent,Object value) throws ValidatorException{
          System.out.println("Inside the validate");
FacesContext context=new FacesContext();
          String firstName=(String)value;
          if(StringUtils.isEmpty(firstName)){
               FacesMessage message=new FacesMessage();
               message.setSeverity(FacesMessage.SEVERITY_ERROR);
               message.setSummary("First Name is Empty");
               message.setDetail("First Name is Empty");
               context.addMessage("Application:T5",message);
faces-config is
<validator>
          <validator-id>isEmpty</validator-id>
          <validator-class>com.obs.ftw.util.validation.isEmpty</validator-class>     
     </validator>
jsf page is
<h:message for="T5"></h:message>
<h:inputText value=#{mybean.lcFirstname} id="T5" required="true">
<f:validator validatorId="isEmpty"/>
</h:inputText>
this function calls isEmpty constructor.but system.out.println("Hi") isn't called which is defined inside the validate()
fuction.
any problem in this isEmpty function?any one give me a solution with an example
advance thanks
with regards
oasisdeserts

Thanks for reply.i was expecting this one and it is working fine .but i want to validate null or empty string using
validator tag.Is any other way to do this .There is no standard way to do this. You may consider to write your own implementation of the JSF LifeCycle.
can u give some explanation to create messagebundle Check chapter 2.5.2.4 of the JSF specification: [http://jcp.org/aboutJava/communityprocess/final/jsr252/index.html]
whether it will be useful to validate empty string?The default behaviour is:
The 'required' attribute already validates the empty value. If the value is empty and the 'required' attribute is set to true, then the "field is required" message will show up (text may depend on the message settings and configuration -- in JSF 1.2 you can use the 'requiredMessage' attribute to specify that message right in the JSF page). If the value is not empty, then the attached validator will be fired, regardless of the setting of the 'required' attribute. If the value is empty and the 'required' attribute is false or not set, then no validation will be taken place.jsf

Similar Messages

  • How to make custom ringtones in iOS 5.1

    How to make custom ringtones in iOS 5.1.
    I was on iOS 4.3 before and i used to create the AAC version and then change the file extension & that file would come up in the Rimtones in iTunes, After the iOS 5.1 i m unable to add the custom ringtones to my iPhone from iTunes.

    Was having this problem too.  Discoverd that that there is a "tones" top menu next to "music" under your iphone settings.  I'm not sure if this is new or not (I am a new iphone owner), but if you check on sync tones they will download.

  • How to make this validation ?

    Dear all
    In my Entity Object I have 4 attributes:
    ID , AccomplishDate ,cancelDate,Status
    I want to make a validation on the Status attribute , which is:
    if status = "CAN" then the CancelDate attribute value will be current date and the AccomplishDate attribute value be null.
    Please can any one tell me how to make this validation.
    Thanks

    Thank you so much for replaying
    The original method was
        public void setProcStatus(String value) {
                 setAttributeInternal(PROCSTATUS, value);
        }I changed it to be like this
          public void setProcStatus(String value) {
            if (value.equals("CAN")){
              setAccomplishDate(new Date());
              setCancelDate(null);
            setAttributeInternal(PROCSTATUS, value);
        }is this right
    please tell me how to set the value of AccomplishDate attribute to the current date

  • How to make custom binary module and add to powershell?

    How to make custom binary module and add to powershell?
    I wish to add 'Microsoft.SharePoint.Client.dll' in powershell as binary module so I can use its intellisense.

    Hi Biraj,
    I replied to this in other thread
    https://social.technet.microsoft.com/Forums/en-US/a13c9cc8-7d53-46b5-b5bb-65404db2d347/how-to-make-intellisense-enable-in-powershell-in-csom-for-sharepoint-online?forum=sharepointdevelopment
    Kind Regards,
    John Naguib
    Senior Consultant
    John Naguib Blog
    John Naguib Twitter
    Please remember to mark this as answered if it helped you

  • How to make custom start end shapes for stroke (arrowheads)...

    hello...
    Indesign cs4 have nice start end stroke shapes like arrowheads, circles, squares...circles is clear, without fill. I need fill in it.
    How to make custom shapes or edit existings start/end shapes to functioning like original provided with indesign?
    Maybe illustrator cs4 have this?

    There's no way to edit line endings in ID. You would have to make a compound path from a line with no ending and a second path or shape for the end.

  • How to make custom data validation on standard form.

    Hi,
    I have some little OAF experience. I have extended VO so far but I am still newbie.
    I need to make custom data validation on standard form.
    I Oracle Credit Management module on "Create Credit Application: Applicant" form I need
    to validate chosen currency against customer setup (whether there is customer profile amount for the currency).
    The page is /oracle/apps/ar/creditmgt/application/webui/ARCMCREDITAPPPAGE
    There are controllers on the page:
    oracle.apps.ar.creditmgt.application.webui.creditAppContentFooterCO 115.14.15104.2
    oracle.apps.ar.creditmgt.application.webui.creditApplicationPageCO 115.6
    oracle.apps.ar.creditmgt.application.webui.creditAppRegion2CO 115.13.15104.2
    oracle.apps.ar.creditmgt.application.webui.creditApplicationCO 115.8.15104.3
    oracle.apps.ar.creditmgt.application.webui.creditAppRegion1CO 115.28.15104.4
    oracle.apps.ar.creditmgt.application.webui.creditAppBusBackCO 115.6
    oracle.apps.ar.creditmgt.application.webui.OCMApplicantInfoRNCO 115.4
    creditApplicationPageCO is pageLayout controller.
    Please direct me how to achieve it.
    Which controller should I extend (if any)?
    How to get values from the page (customer site id, currency) and how to run custom sql in my CO class ?
    Regards,
    Marcin

    Hi Marcin,
    You have to find your GO button is handled in which standard controller, (if you click on the about this page, you should be able to identify the controller,
    or you can download all the controller .class files and decompile and check the logic).
    Then extend that controller(which has the Go button logic, you can see how it has been handled.),
    The usual way to check is
    if(pageContext.getParameter('<Go button name>') !=null)
    Since you want to validate first your custom validation, in the extended controller ProcessFormRequest
    dont call the super.processFormRequest unless your validation is success.
    Call the super at the end.
    Inside your extended controller you have to find your AM and then your required ViewObject to get the user entered values.
    Thanks,
    With regards,
    Kali.
    OSSi.

  • How to make custom icc color profile work as default for all users?

    Hi!
    I've calibrated two monitors for the machine running Mavericks OS X. I've managed to move these custom icc color profiles to ColorSync folder in HDD Library, so that that they are available for all the users. However, I cannot figure out how to make these icc profiles work as default profiles for all users and not only the one I used to calibrate monitors.
    Is there a specific place I have to put custom icc profile to make it system default?
    Thank you!

    If you put the profiles in the root /Library/ColorSync/Profiles/ folder, then each user needs to select them in their account. There isn't a way to apply them globally so each account automatically comes up that way.

  • Need details on how to make custom ABAP report archive enabled

    Hi All,
    We are working in our project to make custom reports as archive enabled so that they can read archived data.
    Need some information on the below queries.
    1.Is there any function module to read selected data from archive file? For example i don't want to read the whole BKPF table data from archive file instead want to get belnr and bukrs only.
    2. What are the perfromance measure which can be taken while making an existing program archive enabled
    3. Important archiving tables which can help for the above.
    4. When i use the function module "Archive_open_for_read' then system displays a pop up to select the archive files based on the archive object.
    Considering that all the reports are run in background how do i make sure that in background run all the archive files are selected and processed.
    Thanks in advance for your valuable suggestions...
    Regards/Ajay

    Hi Ajay,
    1.  You have to create a separate field catelogus and AIS according to your requirement with the required fields you want . Because the standard structures and field catelogues contains many fields from all tables. So before doing the read operation you have to deactivate the standard AIS and activate your newly created AIS .
    2. Can you give some more details for this question to be answered.
    3. The important archiving tables used are ARCH_IDX,ARCH_RPRG,ARCH_DEF.
    4. While scheduling the Read process in batch mode , it will give you three criterias to be entered.
         . Spool Parameters
         (ii). Start date
         (iii). Archive selection of files.
        Unless you enter values for any one of these options , You cannot execute the batch job.
    Hope this would help you.
    Regards - Swarna.

  • How to make Javascript access standard JSF component

    Hello all,
    I'm in need of a proper javascript code that access standard jsf component.
    Like we do for html tags;
    if( el.tagName.toLowerCase() != 'select')
    I need to do the same thing for a jsf tag i.e; <h:selectOneMenu>. How to make javascript access <h:selectOneMenu> like it does with <select> tag ? Please let me know asap. Extremely sorry if the question is kind of stupid....cause I'm a beginner for JSF environment.
    Any sort of help, suggestion or advice would highly be appreciated.
    Thanks in advance.

    Ummmm, I may be off the beaten path, but by the time your javascript is called the h:selectOneMenu would be a select tag within the dom. You should be able to reference that tag as you normally would.

  • Loop in smartform - how to make values valid in all pages

    Hi All.
    I have a smartforms with several pages (9). I must print these 9 pages once for each line in the internal table ITAB. When I put a loop in the first page, the data under that loop is printed correctly, but every text node outside the loop always prints the last line of ITAB.
    Do any of you know how to make the data in the loop valid throughout the other pages?
    any help will be welcome.
    thanks,
    Hermes.

    I got it. The main window must be the first one in the first page. The loop must be inside the main window, and bellow the loop there must be a page-break command.

  • ThinClient t5565z ThinPro Zero how to make custom localizati​on

    Does anyone know how to make a custom language pack for thin clients?
    All I managed is to edit *.mo and *.qm from EasternLanguagePack and pack it into a xar archive, so I was able to see russian text if I choose for example Japanese. But the problem is that this xar is installed every time a thin client is rebooted. And it is not convenient to choose Japanese (or say French) to get Russian translation.
    Any information on creating translations for thin clients would be helpful.
    We tried to ask russian HP office (becuase we need russian translation), but they refused to help.

    Hi,
    Take a look here:
    Re: Fill empty cell with '0'
    Steps to fill empty cell with '0':-
    1. Select intersection cell in cross tab.
    2. Go to properties tab.
    3. In Text Format section, click on Number Format button.
    4. Select Format type is 'Number' and check the Custom check box.
    5. Enter 0 in all text boxes(Positive, Negative, Equal to zero, and Undefined).
    6. Click ok.
    Now you can see 0 in the Emply cells of cross tab.
    If you want decimal values, enter 0.00 in Positive box.
    Edited by: Swarna K on Mar 12, 2011 9:25 AM

  • How to make custom ecards

    Hey, anyone have suggestions for how to make a custom ecard with my photos? I tried 3 services found (one free, two not) online, but they wouldn't edit the photo to fit the card, one imports it with the wrong orientation, (vertical instead of horiz). Know of one that is compatible with Mac. these don't seem to be. Thanks for any help

    Hi Biraj,
    I replied to this in other thread
    https://social.technet.microsoft.com/Forums/en-US/a13c9cc8-7d53-46b5-b5bb-65404db2d347/how-to-make-intellisense-enable-in-powershell-in-csom-for-sharepoint-online?forum=sharepointdevelopment
    Kind Regards,
    John Naguib
    Senior Consultant
    John Naguib Blog
    John Naguib Twitter
    Please remember to mark this as answered if it helped you

  • How to make customer inactive in R12 receivables?

    Does anyone know how to make a customer inactive in R12 receivables? I can find where to make the account that is linked to the customer inactive but not how to amend the status of the customer itself. I am sure that it is something simple that I am missing. Any assistance would be greatly appreciated. Thanks

    Under Data Librarioan responsibility go to Data Quality --> Party Maintenance, search for your party then change the status. Just remember you will not be able to search for Inactive party (untill you re-activate the party again). And more important question: are you sure you want to inactivate a party? Does Oracle recommend it?
    Oleg

  • How to make custom respository as a versioned repository

    hi all,
    how to make or convert custom respository as a versioned repository. and what is versined repository and why we are going for that, can anyone explain clearly,
    thanks and regards
    shya

    please refer to this documentation :
    http://docs.oracle.com/cd/E23507_01/Platform.20073/ATGCAProgGuide/html/s0405createandconfigureversionedrepos01.html

  • How to skip custom validator  if other validators fail

    I have a custom validator that checks data from db, the validator is at the end of the page so it gets called last. If there already are fields in the form that don't validate i don't want to run my custom validator since will not submit anyways and no need to put extra strain on the db. How can i accomplish that?

    Sorry for the confusion. the triggerEvent="click.add" should be triggerEvent.add="click"
    I am using Flex 4. The validation is fail if the user don't input anything. Does clickHandler still process the code even though the validation is fail?

Maybe you are looking for