6

I have in hands the creation of a Warehouse management system. It's going to be a web application, it's supposed to run on desktops and 10' tablets.

I have never worked with barcode scanners, so my question is how do I interface a barcode scanner with my application?

It's going to be a Java EE 6 application, the web framework to use is still open.

Any experience with similar setups would be greatly appreciated.

Arjan Tijms
  • 37,782
  • 12
  • 108
  • 140
Astronaut
  • 6,691
  • 18
  • 61
  • 99
  • 3
    Almost all scanners can act as a "keyboard wedge" meaning if you scan a code of 1234 it will send 1,2,3,4 as keystrokes that you simply have to capture, more sophisticated interaction will depend upon the scanner you use – Alex K. Aug 07 '12 at 10:16
  • Look at this answer to a similar question, think it should help: http://stackoverflow.com/questions/8146840/barcode-scanner-implementation-on-java/8621266#8621266 – DB5 Aug 07 '12 at 10:18
  • I see thanks Alex, so no special care should be needed... it will output characters as if it was written manually using a traditional keyboard. – Astronaut Aug 07 '12 at 10:47

1 Answers1

4

Like Alex K. says, most scanners act like keyboards. So handling the input shouldn't be difficult.

I have seen this type of system implemented with an ActiveX control (Ewwww), but I'm assuming you would want this app to be cross-browser.

Java in the browser is as good as dead now, so an applet would most likely be out of the question.

If the scanner sends a key first you could easily bind an event listener using JavaScript to wait for that key and then take the input.

Snarf
  • 2,251
  • 1
  • 15
  • 17
  • 1
    It depends on the bar code scanner, but most also send a carriage return (in JavaScript it is a keyCode == 13), so you could make things feel a little more integrated by binding on keyUp when an enter key is detected. – Jason Sperske Aug 07 '12 at 22:50
  • Thanks for the replies guys. I will have a scanner available to me soon enough so I can test it. – Astronaut Aug 08 '12 at 13:16
  • @Astronaut I am doing a similar project, can you through some light how did you interface bar code scanner with web application on localhost? – TheTechGuy Feb 27 '19 at 05:50