Suivre ce blog
Editer l'article Administration Créer mon blog
11 octobre 2006 3 11 /10 /octobre /2006 21:27


Here is a Java Bean that allows to use regular expressions with the Sun Java Plug-in.

Regular expressions have been introduced in the Oracle database with the version 10g.
For those who still use a previous version, this Java Bean allows to use regular expressions to achieve complex validations in the Forms text items.
Because the java.util.regex package is available since the 1.4 version of the JDK, we cannot use it with JInitiator that use the 1.3 instruction set. This is the reason why this Bean works only with the Sun Java Plug-in.

regular expression with the Java Plugin

The Java code


The implementation class of the Bean Item


The methods you can call

Set the pattern

Set_Custom_Property('BLOCK.ITEM', 1, 'SET_PATTERN', 'pattern');

e.g. :
Set_Custom_Property( 'BL.BEAN', 1, '
[A-Z][a-z][a-z][a-z]' );   

Set the string to check

Set_Custom_Property('BLOCK.ITEM', 1, 'SET_STRING', 'string');

The properties you can get from the JavaBean

Get the boolean result

Varchar2 :=
Get_Custom_Property( 'BL.BEAN', 1, 'GET_RESULT' ) ;

returns either true or false

Get the corresponding group sub-string

Varchar2 :=
Get_Custom_Property( 'BL.BEAN', 1, 'GET_GROUP' ) ;

Get the start and end position of the substring

Varchar2 :=
Get_Custom_Property( 'BL.BEAN', 1, 'GET_POS' ) ;

returns a value like : start_position,end_position

The sample dialog

     . Download the regularexp.zip file
     . Unzip the file
     . copy the regularexp.jar file in the <ORACLE_HOME>/forms/java directory
     . Edit your /forms/server/formsweb.cfg file
     . Open the REGULAREXP.fmb module (Oracle Forms 10.1.2 and Java Plug-in 1.5.0_06)
     . Compile all and run the module

Partager cet article

Published by Oracle Forms community - dans Bean - general
commenter cet article