serratus / quaggaJS

An advanced barcode-scanner written in JavaScript
https://serratus.github.io/quaggaJS/
MIT License
5.03k stars 978 forks source link

Can i use quaggaJS on JSP? #398

Open doy0818b opened 4 years ago

doy0818b commented 4 years ago

Hello Delvelopers. I'm a college student working on a project to create a web app with jsp. I trying to get barcode number for a product using jsp, but it does not work. According to the guide, quaggaJS can use script tags I tried to create the following example script that includes dist / quagga.min.js but it doesn't work. https://serratus.github.io/quaggaJS/v1.0.0-beta.1/examples/scan-to-input/ I copied this page to see if it worked, but it failed. this is the best way for my project.

I would appreciate it if you could tell me how to use this as jsp.

:My development environment is tomcat and jsp in eclipse.

ericblade commented 4 years ago

We will need a better description of "it doesn't work" to be able to help you. I doubt that it's anything related to JSP, as long as the HTML the client is receiving is correct.

doy0818b commented 4 years ago

thank you for reply.

i tried copy that web page. but nothing happens when I press the button.

this is my jsp code.

`<!DOCTYPE html>

`

ericblade commented 4 years ago

"nothing happens" isn't really a description here, I think you'll need to learn to use your browser's debugger to see what the source of the problem is. I'm going to guess that most likely you're not loading it from a secure server (https) which is necessary for camera access in browser. As you can see from the link above, that exact code works fine, and whatever software is serving it isn't relevant, so you'll need to look at the javascript console in chrome or whatever to see what is failing.

solsticesurfer commented 4 years ago

Yes, you can use it with JSP. Java Server Pages (JSP) is just a convenience format for creating a Java servlet that returns HTML code to the client. The returned code is no different than if you had coded the web page's content manually. JSP does not interpret, modify, or run any of the HTML or JavaScript code on the server side.

If you want to remove JSP from the equation as a possible cause of why it might not be working for you, simply create a plain HTML page and try to get the scanning to work from there first. Really, tho, there is no difference between a standard HTML page and a JSP page as far as the browser is concerned. The results are identical.