J4L-One Code for the Java[TM] platform

Copyright J4L Components (http://www.java4less.com) 2006.

Introduction

The package J4L-OneCode contains the classes you need to create One Code barcodes (also known as the USPS 4-State Customer Barcode , 4CB or 4-CB) within your jsp or java applications.

One Code barcodes consist of 65 bars. Each bar can be printed in one of four states; full, track, ascender or descender.

 

One Code barcodes can encode the following information:

The component allows you to configure the dimensions of the barcode:

 

Installation and requirements

In order to install the software you just need to unzip the ZIP file in an empty directory (your must unzip with pathname so that the subdirectories are properly created.

Java applications

In order to run the sample application you must execute runDEMO.bat. The sample application requires JDK 1.3 or later. However the component will also work with JDK 1.1 or 1.2. Let us know if you need a test version for java 1.1 or 1.2.

In the sample application you can set all properties of the OneCode symbology.

You can execute the following commands:

 

The Servlet

OneCode comes with a standard servlet (OneCodeServlet) you can use to create One Code images. The parameters for the servlet can be sent using GET or POST commands. The parameters are:

For example, if you want to test the servlet using Tomcat 5 you must do the following:

  1. copy the content of the jsp_servlet subdirectory to /tomcat/webapps/onecode/
  2. Start the server and test the servlet entering the following address:

    http://localhost:8080/onecode/ServletExample.html

In order to propertly print a barcode created with the servlet you must use the <IMG> tag. In this way you can embed the image in your HTML page. Note that you will need to use the attibutes height and width in order to achieve the correct size of the barcode on the printed page.

This is a simple HTML page that contains a qrcode symbol:

<HTML>
<HEAD>

<TITLE>Servlet Example META http-equiv=Content-Type content="text/html; charset=windows-1252">

</HEAD>
<BODY bgColor=#ffffff>

This is your Barcode:
<IMG height=100 width=100 src="http://localhost:8080/onecode/servlet/OneCodeServlet?BARCODE_IDENTIFIER=1&SPECIAL_SERVICES=234&...." >

</BODY>
</HTML>

The Applet

You must add the following code in your html pages to use the applet:

 

<APPLET
CODEBASE = "./"
CODE = "com.java4less.onecode.OneCodeApplet.class"
ARCHIVE = "onecode.jar"
NAME = "TestApplet"
WIDTH = 300
HEIGHT = 250
HSPACE = 0
VSPACE = 0
ALIGN = middle
>

<PARAM NAME = "BARCODE_IDENTIFIER" VALUE = "1">

.....

</APPLET>

Note that the onecode.jar file must be located in the directory referenced by the CODEBASE parameter.

The available paramete are the same as those used by the servlet (see list description in the previous section).

There is an examle in applet/AppletExample.html file.