Showing posts with label error message. Show all posts
Showing posts with label error message. Show all posts

Tuesday, 6 October 2015

ADF : Resolved! Failed to convert internal representation error in ADF

While development some times this error occurs in VO's and EO's in ADF.

Main Cause : The main cause of this error is that the Datatype mismatch of the Columns in Database and  in ViewObject (or Entity Object).

For example : Suppose you have a DEPT_ID String Column in the Database of type String and in EntityObject or ViewOject its type is Integer then this error will occur.

What happens is that when the framework tries to convert the value in the database i.e (String in this case like 'DEPT_01') to the type defined in the ViewObject or EntityObject i.e. Integer, then it fails to type cast 'DEPT_01' to Integer as it contains character that cannot be converted to Integer and this error is thrown.

Solution : Make sure the all the datatype of all the attributes in the ViewObect or EntityObject are in Sync with the database and there is not mismatch.

Thursday, 21 February 2013

ADF: Code to show error msg in page

## Code to show error msg  in page


throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR,”msg”,null));


Note: This code works only in the validator block

ADF: Popup Dialauge listener


## ADF: Popup Dialauge listener

public void dailogok(DialogEvent dialogEvent) {
   
    if(dialogEvent.getOutcome().name().equals("ok")){
        BindingContainer bindings = getBindings();
        OperationBinding operationBinding =bindings.getOperationBinding("Commit");
        operationBinding.execute();
    }

ADF: Show FacesMessege or we can say PopUp Message in ADF

Hello all,

This is a very basic post on ADF. This is about how we can show notification Messages. For showing Notification Messages in ADF page we use FacesMessage Component. This component can be used to show many type of message. 

Here is the code to show FacesMessage :


FacesMessage message = new FacesMessage("Record Saved Successfully!");   
      message.setSeverity(FacesMessage.SEVERITY_INFO);   
      FacesContext fc = FacesContext.getCurrentInstance();   
      fc.addMessage(null, message); 

And the message will come like :


You can change the severity of the message and show different kind of Message.

So the above code will show the facesMessage in a popup.

You can also attach this message to a component , for example you want a show a facesMessage attached to a inputText.
For doing so all you need is the id of the component.

For the above create a binding for the component in the bean.



 FacesContext.getCurrentInstance().addMessage(this.getTextCompBind().getClientId(), msg);

You can see the facesMessage attached to the component now.


this.getTextCompBind().getClientId()

The above code fetches the Id of the component which is defined in the id attribute of the component. If you know the id of the component you can put it directly as a string. In this case you have used a inputtext so you can use the id like "it1".

If you want to see a sample , click here : FacesMessageTest.jar