Reset Binding Value from InputText in Oracle ADF

Use Case – We have one jsff page and contains some inputtext .On same page there is one Save button and one Cancel button.When user came to the page and try to enter some value in input text field and user click on Cancel button, its not resetting InputText value.When user come on same page again then he can able to see my previously entered value in Input Text though user clicked on cancel.

Normal developer will wrote Action Listener on Cancel Button and wrote below code

input.resetValue() ;
adfFacesContext.addPartialTarget(input);

But its will work (reset values).Setting value in input will not work like

input.setValue(null);
or
input.setValue("");

Few developers will think, why cant we use resetActionListener. It will work for sure,but if you make autoSubmit of inputText to true, it will not work.
Reason- InputText has autoSubmit set to true, which submit the values to model immediately after updating it, resetActionListener resets values only if changes are not populated to model.

For this case use below code.Get current row and do REFRESH_FORGET_NEW_ROWS

    Row r1=vo.getCurrentRow(); 
    r1.refresh(oracle.jbo.Row.REFRESH_UNDO_CHANGES |  Row.REFRESH_FORGET_NEW_ROWS);  
or 
    r1.refresh(r1.REFRESH_UNDO_CHANGES | r1.REFRESH_WITH_DB_FORGET_CHANGES);   

Note : If you don’t need autoSubmit, you can just remove it and use resetActionListener without any bean method to undo current row changes

It will reset binding value of input text.

Happy learning with Vinay Kumar in techartifact..

Changing default Navigation Model in Webcenter portal

Requirement- In your webcenter Portal application , if you dont want to use seeded navigation model and you create your own navigation model and you want to make your navigation model
as default navigation model.

Implementation – When you create an Webcenter portal application using create new application and selection Webenter Portal application then seeded navigation model, default-navigation-model.xml, is set as the application’s default navigation model. Now if create your own navigation model to use for the main navigation path through your application, rather than having to explicitly reference this navigation model whenever you want to use it, you can set it as the default.
You can set the default navigation model for a Portal Framework application by editing the oracle.webcenter.portalapp.navigation.model preference in the adf-config.xml file.

-> Open the adf-config.xml file

-> Click the Source tab.Locate the ADF preference with the following id:

      oracle.webcenter.portalapp.navigation.model
      

-> Set the value attribute to the path of the navigation model that you want to use as the default for the application, for example:

value=”/oracle/webcenter/portalapp/navigations/techartifactNavigationModel.xml”

Below is adf-config.xml will look like

<preference id="oracle.webcenter.portalapp.navigation.model"
            desc="Default Navigation Model"
            value="/oracle/webcenter/portalapp/navigations/techartifactNavigationModel.xml"
            resourceType="navigation" display="true"/>

-> Save the adf-config.xml file.

Happy learning with Vinay Kumar in techartifact