This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



Apr 13, 2011, 4:58 PM
40 Posts

Re: Problem with Validation Message from a Managed Bean

  • Category: Managed Beans in NSF
  • Platform: All
  • Release: 8.5.2
  • Role: Developer
  • Tags: Managed Bean,validation
  • Replies: 2
Glad the article helped!
 
Can you post some of your example code? I don't remember the class being pre-pended to the error message .. the code I would use to throw the validation message is:
 
throw new javax.faces.validator.ValidatorException(new javax.faces.application.FacesMessage("Email Not Valid!"));
 
Where the ValidatorException gets thrown and the parameter for that is a new FacesMessage with the text that you want to display as the error text as its parameter.
 
 
Thanks 
 
Jeremy 
Apr 14, 2011, 2:14 PM
24 Posts
Re: Problem with Validation Message from a Managed Bean
 Jeremy,
 
Below is my Java Code to validate and employee Id. 
 
Thanks for your help. 
 
-- Jeff 
 
// Validate the Employee
public void validateEmployee(FacesContext context, UIComponent component, java.lang.Object value) {
View lookupView;
        Document personDoc;
        
        try {      
        
         Session session = JSFUtil.getCurrentSession();            
            Database database = session.getDatabase("", "names.nsf");
            
            if (database != null) {
                lookupView = database.getView("$Users");                
                if (lookupView != null) {
                                
                    personDoc = lookupView.getDocumentByKey(value);
                    if (personDoc != null) {
                                  
             // Do stuff here
                
             personDoc.recycle();    
            
            
             } else {
                 throw new javax.faces.validator.ValidatorException(new javax.faces.application.FacesMessage("Invalid Employee Id: (" + value + ")"));              
             }
              
                 lookupView.recycle();
                    
                } else {
                 throw new javax.faces.validator.ValidatorException(new javax.faces.application.FacesMessage("Could not open view $Users"));
                }
                
            } else {
             throw new javax.faces.validator.ValidatorException(new javax.faces.application.FacesMessage("Could not open Names.nsf"));
            }
               
        } catch (NotesException e) {
            throw new javax.faces.validator.ValidatorException(new javax.faces.application.FacesMessage("An unknown Exception Occurred processing Code: validateEmployee()"));
        }
   } 

This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal