How to set ‘autoComplete’ property for html:text component in struts

If you are developing your jsp page using struts then, In few cases you get a requirement that while typing in an input filed it should not show the suggestions that previously entered.

So generally to achieve this we use the property ‘autoComplete=off’ for html input fields. But struts <html:text> doesn’t support this property. So to achieve this feature in struts we have three options.

1) Use normal html input component in the place of  struts html:text component.

<input type="text" value="" autoComplete="off" size="10" maxlength="10" name="Account" />

2) Use <html:text> in the following way that you set ‘autoComplete’ like a css injection. The below method can be used to set properties for the components which are not supported by struts html by default.


<html:text size="10" maxlength="10" property="Account" styleClass="\" autoComplete=\"off" />

3) Create a class extending Form class or Text class and add a custom property in it.

4) You can think of using jQuery also.

 

Service Callout In OSB

Prerequisite: For understanding this you must have some basic knowledge on SOA as this post involves using SOA to make it more clear to understand.

Well, Service Callout in OSB is similar to Invoke activity in SOA. We use Invoke activity in SOA to trigger external services like (WS Service, DB Service, JMS Service, FTP Service etc). Similarly we use Service Callout in OSB to trigger external services.

Similarities & differences b/w Invoke & Service Callout: Both used to trigger external services, but Invoke can be used for both Synchronous& Asynchronous external services (i.e the calling external service may or may not give the response). But Service Callout is used only to trigger Synchronous external services. To trigger oneway services there is another component in OSB which is ‘Push’ which also works same as Service Callout, only difference is Push is used for triggering Oneway external services and Service Callout is used for triggering Synchronous external services. Invoke activity will be having ‘Input Variable’ and ‘Output variable’ and similarly Service Callout will also has ‘Request Variable’ & ‘Response Variable’.

Let’s take a simple example and discuss about why and where we use Service Callout in OSB. I’ve a an external service asynchronous  service ‘EmployeeInfo’ which accepts EmployeeId, EmployeeName as inputs.

  1. So in OSB first we have to import Resources (WSDL, XSD) for that external WSDL service. Then we have to create Business Service calling the ‘EmployeeInfo’ WSDL.
  2. Create a proxy service based out of Business Service created earlier.
  3. Now we have to pass ‘EmployeeId’, ‘EmployeeName’ as inputs the proxy service which will pass the same as inputs to the business service. But let’s make a requirement like we pass only ‘EmployeeId’ as input to the proxy service then in the Message Flow we have to call another external service ‘EmployeeName’ wsdl, passing ‘EmployeeId’ to get the respective ‘EmployeeName’ and then pass this retrieved ‘EmployeeName’ along with ‘EmployeeId’ to the ‘EmployeeInfo’ wsdl.
  4. So we have to create another Business Service calling ‘EmployeeName’ wsdl.
  5. From the MessageFlow using Service Callout call the ‘EmployeeName’ wsdl. While calling that service pass the ‘EmployeeInfo->EmployeeId’ to the ‘EmployeeName Request variable’ using Assign activity.
  6. Get the response from ‘ EmployeeName Response variable’ and replace it on ‘EmployeeInfo->EmpName’ using Replace activity. This concept is called Message Enrichment.

This is how and why Service Callout is used in OSB. Find below few screnshots for your reference.

The below screen explains about service callout variables (similar to Invoke activity input, output variables)

Note: In all the below screens please assume Customer as Employee.

ServiceCallout

Below screen explains about how we assign ‘EmployeeInfo->EmployeeId’ to ‘EmployeeName request variable’ with the help of Assign.

Assign

Below screen explains about how we replace the EmployeeInfo payload, ‘EmployeeInfoBS->EmployeeName input field’ to ‘EmployeeNameBS response variable’ with the help of Replace.

Replace

To make the above example work we need two SOA services ‘EmployeeInfo’ (Asynchronous) and ‘EmployeeName’ (synchronous) to be created and deployed on server. Which then have to be used in OSB project for creating business services.

Find below screens for SOA BPEL for EmployeeInfo’ (Asynchronous)

EmployeeInfoProcess

Find below screens for SOA BPEL for ‘EmployeeName’ (synchronous).

EmployeeNameProcess

Hope this post helps you to understand concept of Service Callout in OSB.

OSB 11g Installation (Software Required for Setup and links to download)

For complete set up of OSB we need to install multiple software on our machine and this post put all the necessary information for that here.

The below information is specific to Windows OS 64 bit machine.

1) Download JDK 6 and install
http://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase6-419409.html

2) Download Oracle DB 11g XE and Install (while configuration remember password given)
http://www.oracle.com/technetwork/database/database-technologies/express-edition/downloads/index.html

3) Download RCU 11.1.1.7.0 and Install (Give DB credentials as username:sys, password: pwd given while DB installation, host: localhost, port:1521, service: XE) & in in step check the SOA & BPM Infrastructure checkbox as we need those schema only)
http://www.oracle.com/technetwork/middleware/soasuite/downloads/soasuite11gdownload-2210918.html

4) Download weblogic server 10.3.6 generic . It is available in three locations given below.
http://www.oracle.com/technetwork/middleware/soasuite/downloads/soasuite11gdownload-2210918.html [10.3.6 Size: 0.99 GB] (or)
http://www.oracle.com/technetwork/middleware/service-bus/downloads/index.html (or)
http://www.oracle.com/technetwork/middleware/weblogic/downloads/wls-main-097127.html [Generic (997 MB) ]

Note: While Installation you have to specify Middle ware directory, remember that.

5) Download OEPE 11.1.1.8 (oepe-indigo-win64.zip) and place the extracted folder into the Middlware folder created in earlier step.
http://www.oracle.com/technetwork/developer-tools/eclipse/downloads/oepe-11118-521475.html

6) Download Oracle Service Bus Generic (Release 11gR1 (11.1.1.7.0)
http://www.oracle.com/technetwork/middleware/service-bus/downloads/index.html

After download open the OSB installer file and go to win64 installer. Run the installer (double click on it). It will ask for JDK path, provide the JDK path and it launch the installation wizard.

e.g. D:\Softwares\Fusion\ofm_osb_generic_11.1.1.7.0_disk1_1of1\Disk1\install\win64

e.g: C:\Program Files\Java\jdk1.6.0_45

Domain Setup: Once you are done with above installations then you need to do a domain creation/ configuration.

Windows -> All Programs -> oracle weblogic -> Weblogic Server 11gr1-> Tools -> Configuration Wizard.

I hope this post helps you to set up OSB 11g on your machine. If you have any doubts feel free to post in the comment section.

 

Oracle SOA 12.2.1 (SOA, OSB, OEP,ADF) Installation, RCU Creation, Domain Configuration

The installation has become quite easy from 12c versions of Oracle SOA.

1) Download SOA Suite 12.2.1 from Oracle website which comes with two zip folders. Unzip them to a same directory which will be having two jar files. Now execute below command in cmd console with administrative privileges.

soa

Provide the directory path and select appropriate options which completes the Installation.

2)  Now RCU Installtion. For this you must have Oracle DB (I suggest Oracle 11g XE edition).

Once you have DB on your machine go to folder ‘D:\Middleware12.2.1\Oracle_Home’ and execute rcu.cmd file. During the process give DB details which will then creates required schemas onto DB.

3) Now Domain Configuration. For this go to ‘D:\Middleware12.2.1\Oracle_Home\oracle_common\common\bin’ and execute config.cmd file.During configuration select required options and complete configuration.

You can found detailed steps of installation at below link.

https://dzone.com/articles/oracle-soa-1221-installation-and-configurations

 

 

 

\oracle_common\bin’

Exceptions in Java

There are many exceptions in Java. We can categorize them into two categories.

  1. Checked Exceptions (Which we can handle)
  2. UnChecked Exceptions (Which we can not handle- Run time)

Now let’s talk about each exception in Java.

Checked Exceptions: Remember that checked exceptions means the exceptions which we can handle. Few exceptions give error at compile time itself. Few exceptions doesn’t give exception at compile time but give at run time. But remember that what ever exceptions we can handle are checked exceptions. We do arithmetic operations and there might be a possibility to get exception if we pass zero to divide operation. So we can predict this error and can handle it with a catch block ArithmeticException or using throws ArithmeticException . We pass some values and execute some code and we have to predict what if the value passed is Null then we have to handle that using NullPointerException. So like these we have to predict the possibilities of getting and exception and have to handle them. If we can not predict the exceptions/ can not handle them then those are unchecked exceptions.

1. NoClassDefFoundException:

If the class reference is not available at runtime (though it is present at compile time and some how got deleted after that) then this error occurs. So this un cached exception as we can’t handle this exception.

2. ArithmeticException: Arithmetic error, such as divide-by-zero.

public static void main(String[] args) {
ArithMethod(40,0);
}
private static void ArithMethod(int a, int b) {
try{
int c = a/b;
}
catch(ArithmeticException ae){
System.out.println("Arithmetic Exception caught..");
}
}

3. NumberFormatException: Invalid conversion of a string to a numeric format.


try{
String v ="12j";
Integer inte = Integer.parseInt(v);
System.out.println("inte:"+inte);
}
catch(NumberFormatException nume){
System.out.println("NumberFormatException Caught...");
}

4. SecurityException: Attempt to violate security.

5. SqlException

6. ArrayIndexOutOfBoundsException: Array index is out-of-bounds


public static void main(String[] args) {

arrayBound();
}

private static void arrayBound() {
try{
int[] g = new int[3];
g[0] = 32;
g[1] = 26;
g[2] = 43;
g[3] = 61;
}
catch(ArrayIndexOutOfBoundsException AIOe){
System.out.println("ArrayIndexOutOfBoundsException Caught...");
}
}

7. StringIndexOutOfBoundsException: 

8. IndexOutOfBoundsException: Some type of index is out-of-bounds.

9. NullPointerException: Invalid use of a null reference.

Eg:


String s3=null;
try{
String s31 = new String(s3);
}
catch(Exception ne){
System.out.println("Null Pointer Exception Caught..");
}

I’ve listed few mostly used exceptions and There are few more catched exceptions in Java.

UnChecked Exceptions:

1. ClassNotFoundException:

If the class reference is not available at the time of compilation then this error occurs. So this is a compile time exception.

2. CloneNotSupportedException

Attempt to clone an object that does not implement the Cloneable interface.

3. IllegalAccessException

Access to a class is denied.

4. InstantiationException

Attempt to create an object of an abstract class or interface.

5. InterruptedException

One thread has been interrupted by another thread.

6. NoSuchFieldException

A requested field does not exist.

7. NoSuchMethodException

A requested method does not exist.

8. ResourceNotFoundException:

9. ResourceUnAvailableException:

Hexa to Decimnal conversion in Java

Have you ever tried to print the value of int i=0xbb; ? Do you think it’ll give numeric exception? No it works well and gives you the output of ‘187’. What is this value? It’s a decimal value of ‘bb’.

Well now coming to the point if you give value to integer starts with 0x (zero alphabet x) then jvm will convert the next value after prefix (assumes it as hex value) to decimal value. In the above example the hex value is ‘bb’ and its decimal value is ‘187’ which is then stored into integer. Want to cross check ? You can also do that calculation like below.

eg1: bb -> 11 X 160 + 11 X 161 = (11+176)= 187

eg2: bd -> 13 X 160 + 11 X 161 =(13+176)=189

Confused with Decimal and Hex values? Check below.

Hex             0     1     2     3     4     5     6     7     8     9     A       B     C       D      E       F
Decimal     0     1     2     3     4     5     6     7     8     9     10     11     12     13     14     15

Note: You can see decimal values for the alphabets a to f only. If you give any alphabet other than a to f then it’ll syntax error.

Leave your comments and suggestions in below comment section. Hope you enjoyed the post 🙂