How to perform addition for attribute of Number type in expression language

When adding two attributes of oracle.jbo.domain.Number type in Expression Language like EmpSal and EmpBonus as below  :

#{bindings.bindings.EmpSal.inputValue + bindings.EmpBonus.inputValue}

or adding number 1000 to EmpSal as  :

#{bindings.bindings.EmpSal.inputValue + 1000}

You may get below exception :

Unexpected exception caught: java.util.MissingResourceException, msg=Can’t find resource for bundle java.util.PropertyResourceBundle, key el.convert

To Eliminate this Exception, Add EmpSal and EmpBonus as below :

#{bindings.EmpSal.inputValue.value + bindings.EmpBonus.inputValue.value}

Add ‘value’ to inputValue to remove the exception.

Happy learning in TechArtifact. 🙂

Fetching server name and port number for ADF application

Requirement – How to get server name and server port.
Solutions- You can get this information in by writing below code in java

FacesContext fctx = FacesContext.getCurrentInstance();
HttpServletRequest request = (HttpServletRequest) fctx.getExternalContext ().GetRequest ();
String serverName = request.getServerName();
int serverPort =request.getServerPort();

System.out.println ("Server Name:" + serverName);
System.out.println ("Server Port no:" + server port);

Happy coding with Vinay Kumar in Techartifact.

Adding number for Primary key in oracle ADF using groovy by sequence

Requriement – To create a primary key using sequence in Oracle ADF while create operation.

We have the primary key for any table.

We open the EO of that table. Go to attribute tab. select Primary key ID and go to property.

Select the default value to be “Expression” . and put value as

(new oracle.jbo.server.SequenceImpl(“SEQUENCE_NUMBER”,adf.object.getDBTransaction())).getSequenceNumber()

see the below screen shot

That it.. When you use create operation.Primary key will be generated automatically.

Happy Coding….