Home:  Products:  Java Servlets with Tomcat Tutorial:

Implementing Barcodes with Apache Tomcat using IDAutomation's Java Servlets

This tutorial will demonstrate how to implement barcodes with the Apache Tomcat application server using IDAutomation's Java Servlets.

INDEX:

Configuring Apache Tomcat to Run our Java Servlets

Java Servlets are used to add barcode support to a dedicated webserver. IDAutomation's Servlet is compatible with all browsers and is easy to embed in HTML as an image with the <IMG> tag. These Java Servlets can be easily hosted on a client's server or outsourced by an ISP that supports Java Servlets.

Servlet Barcode Implementation Example Using Apache Tomcat:

  1. Place the LinearBarCode.jar file in the /WEB-INF/lib directory of the WebApp.
  2. Install or verify use of JDK 1.2 or above. The encoder requires Java 2 or JDK 1.2 or above to create the JPEG files used by the servlet.
  3. Special requirements for Linux and Unix servers:
    1. Be sure Java.awt GUI functions are available in the environment. This is not an issue with Windows® servers. In UNIX or Linux, if the Java environment has the java.awt library stripped out, then the Java products will not be useable.
    2. If the server does not have an X-Window environment, either (1) use Headless Java or (2) connect to a remote X Server or (3) install the X Windows environment and run an X Windows session or (4) install an emulator, PJA library or virtual frame buffer as described in the XWindow Error Document. If the server has problems in this area and the ability to modify the environment is not an option, try outsourcing to an ISP that supports Java Servlets if possible.
  4. Edit the web.xml in the appropriate /WEB-INF/ directory for the WebApp. Insert the following lines in the Servlet Mappings section:
     <servlet>
               <servlet-name>LinearServlet</servlet-name>
               <servlet-class>com.idautomation.linear.IDAutomationServlet</servlet-class>
     </servlet>
     <servlet-mapping>
               <servlet-name>LinearServlet</servlet-name>
               <url-pattern>/servlet/LinearServlet</url-pattern>
     </servlet-mapping>
  5. To sign up for monthly updates about new products or upgrades, please click here.Restart the Apache Tomcat server by either restarting the service or executing the appropriate control scripts per system configuration.
  6. After the servlet server is started, type the following code into a browser and specify applet parameters to create the barcode. This URL creates a barcode encoding "12345678" with a height if .8CM:
    http://localhost:8080/servlet/LinearServlet?BARCODE=12345678&BAR_HEIGHT=.8
  7. Once the servlet is working, see Inserting Barcodes into HTML.

 

 Product Quick Links: [Barcode Fonts | Font Tools | Components | Label Software | Scanners | Printers | RFID | Product Index]

Copyright © 2000-2008 IDAutomation.com, Inc., All Rights Reserved. Legal Notices.

Over 70% of Fortune 100 companies use our products to automate their businesses.