Hitachi

uCosminexus Application Server System Setup and Operation Guide


L.10 Sample of Bean Validation and CDI integration application

The sample program using the Bean Validation and CDI integration application is stored in the following directory:

Application-Server-installation-directory\CC\examples\bv_cdi

This subsection gives an overview of the sample and describes the execution procedure.

Organization of this subsection

(1) Overview of the sample program of Bean Validation and CDI integration application

Thi sample program provides a sample combining Bean Validation, CDI, and JSF.

With the sample Bean Validation and CDI application, the following settings must be implemented before you execute the sample:

The following figure shows the Application-Server-installation-directory\CC\examples\bv_cdi configuration.

Figure L‒47: bv_cdi directory configuration

[Figure]

(2) Execution procedure of the sample program of Bean Validation and CDI integration application

The procedure for executing the sample program is as follows:

(a) Compiling the sample program

Use the batch file (compile.bat) provided with the sample to compile the sample program. This batch file creates a WAR file (paramcheck.war) and EAR file (paramcheck.ear).

(b) Setting the J2EE server

See Appendix L.1(1) Setting the J2EE server.

(c) Customizing the J2EE server

See Appendix L.1(2) Customizing the J2EE server.

(d) Starting the J2EE server

See Appendix L.1(3) Starting the J2EE server.

(f) Executing the application

Start the browser and specify the following string in the URL to execute the application:

http://computer-name:port-number/paramcheck/

If the port number has been customized, specify the customized port-number.

The following figure shows an example execution of the sample program of Bean Validation and CDI integration application.

Figure L‒48: Example execution of the sample program of CDI integration application

[Figure]

Click the Submit button to display the validation results in the message output location.

The following table describes the message output conditions and the output messages.

Table L‒8: Message output conditions and the output messages

No.

Condition

Output message#1

1

When the validation is successful

Validation Successful!

2

When a string of 16 or more characters is entered in the Name textbox#2

size must be between 0 and 15

The name must be no more than 15 characters.

3

When a value smaller than 0 is entered in the Age textbox#2

must be greater than or equal to 0

The age is less than the minimum value. Enter a number from 0 through 120.

4

When a value greater than 120 is entered in the Age textbox#2

must be less than or equal to 120

The age exceeds the maximum value. Enter a number from 0 through 120.

5

When a value that cannot be converted into a number is entered in the Age textbox#2

For your age, enter a number (0 to 120).

6

When an exception occurs in the validation processing

Validation Failed.

#1

If there are multiple causes of validation failure, the respective messages are output consecutively.

#2

No.6 "When an exception occurs in the validation processing" is not output for the messages output due to these conditions.

(g) Un-deploying the application

See Appendix L.1(6) Stopping and deleting the application.

(h) Stopping the J2EE server

See Appendix L.1(7) Stopping the J2EE server.