primefaces qr代码没有显示? [英] primefaces qr code not shown?
问题描述
我正在使用primefaces来开发一个网络应用程序。我正在尝试在网页上显示条形码。除了QR代码外,所有编码器都显示出来。我已经读过这个
需要两个jar文件< img src =https://i.stack.imgur.com/25KnA.pngalt =sample>
- barcode4j:2.1
- qrgen:1.4
<我已经在lib文件夹中添加了这些jar文件&尝试运行它。这样,当我在lib文件夹中添加qrgen时,我得到404错误。
我尝试使用maven,我添加了依赖,如下所示:
< dependency>
< groupId> net.glxn< / groupId>
< artifactId> qrgen< / artifactId>
< version> 1.4< / version>
< / dependency>
< dependency>
< groupId> net.sf.barcode4j< / groupId>
< artifactId> barcode4j-light< / artifactId>
< version> 2.1< / version>
< / dependency>
但我得到第二个依赖的错误,所以我复制了lib文件夹中的barcode4j,但我无法打印QR码。请帮助我。
xhtml的代码
<!DOCTYPE html>
< html xmlns =http://www.w3.org/1999/xhtml
xmlns:h =http://java.sun.com/jsf/html
xmlns:p =http://primefaces.org/ui>
< h:head>
< title> login< / title>
< / h:head>
< h:body>
< p:panelGrid columns =2>
< h:outputText value =Interleaved 2 of 5/>
< p:条形码值=0123456789type =int2of5/>
< h:outputText value =Codabar/>
< p:条形码值=0123456789type =codabar/>
< h:outputText value =Code39/>
< p:条形码值=0123456789type =code39/>
< h:outputText value =Code128/>
< p:条形码值=0123456789type =code128/>
< h:outputText value =EAN-8/>
< p:条形码值=20123451type =ean8/>
< h:outputText value =EAN-13/>
< p:条形码值=0123456789012type =ean13/>
< h:outputText value =UPC-A(PNG)/>
< p:条形码值=01234567895type =upcaformat =png/>
< h:outputText value =UPC-E(垂直)/>
< p:条形码值=01234133type =upceorientation =90/>
< h:outputText value =PDF417/>
< p:条形码值=0123456789type =pdf417/>
< h:outputText value =DataMatrix/>
< p:条形码值=0123456789type =datamatrix/>
< h:outputText value =Postnet/>
< p:条形码值=0123456789type =postnet/>
< h:outputText value =QR/>
< p:条形码值=0123456789type =qr/>
< / p:panelGrid>
< / h:body>
< / html>
pom.xml
< project xmlns =http://maven.apache.org/POM/4.0.0xmlns:xsi =http://www.w3.org/ 2001 / XMLSchema-instance
xsi:schemaLocation =http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd >
< modelVersion> 4.0.0< / modelVersion>
< groupId> com.prime< / groupId>
< artifactId> primedemop< / artifactId>
< version> 0.0.1-SNAPSHOT< / version>
< name> primefaces< / name>
< dependencies>
< dependency>
< groupId> com.sun.faces< / groupId>
< artifactId> jsf-api< / artifactId>
< version> 2.2.2< / version>
< / dependency>
< dependency>
< groupId> com.sun.faces< / groupId>
< artifactId> jsf-impl< / artifactId>
< version> 2.2.2< / version>
< / dependency>
< dependency>
< groupId> javax.servlet< / groupId>
< artifactId> javax.servlet-api< / artifactId>
< version> 3.0.1< / version>
< / dependency>
< dependency>
< groupId> org.primefaces< / groupId>
< artifactId> primefaces< / artifactId>
< version> 5.1< / version>
< / dependency>
< dependency>
< groupId> net.glxn< / groupId>
< artifactId> qrgen< / artifactId>
< version> 1.4< / version>
< / dependency>
< / dependencies>![smaple] [2]
< / project>
我猜你一切都好。但是你错过了一件事。你使用的qrgen-1.4进一步依赖 zxing-core-2.0 & zxing-javase 尝试将这两个jar文件包含到您的构建路径中,这些可能会很好用。
I am using primefaces to develop a web app.I am trying to show the bar code on mhe webpage.All coders are shown except the QR code.I have read that two jar files are required for this
- barcode4j: 2.1
- qrgen: 1.4
I have added these jar files in the lib folder & try running it.In this way i get 404 error when i add qrgen in lib folder.
I tried doing it using maven i added the depedency as follows:
<dependency>
<groupId>net.glxn</groupId>
<artifactId>qrgen</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>net.sf.barcode4j</groupId>
<artifactId>barcode4j-light</artifactId>
<version>2.1</version>
</dependency>
but i get error for second dependency so i copied the barcode4j in lib folder but i can't print the QR code.please help me out.
code for xhtml
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:h="http://java.sun.com/jsf/html"
xmlns:p="http://primefaces.org/ui">
<h:head>
<title>login</title>
</h:head>
<h:body>
<p:panelGrid columns="2">
<h:outputText value="Interleaved 2 of 5" />
<p:barcode value="0123456789" type="int2of5" />
<h:outputText value="Codabar" />
<p:barcode value="0123456789" type="codabar"/>
<h:outputText value="Code39" />
<p:barcode value="0123456789" type="code39" />
<h:outputText value="Code128" />
<p:barcode value="0123456789" type="code128"/>
<h:outputText value="EAN-8" />
<p:barcode value="20123451" type="ean8"/>
<h:outputText value="EAN-13" />
<p:barcode value="0123456789012" type="ean13"/>
<h:outputText value="UPC-A (PNG)" />
<p:barcode value="01234567895" type="upca" format="png"/>
<h:outputText value="UPC-E (Vertical)" />
<p:barcode value="01234133" type="upce" orientation="90"/>
<h:outputText value="PDF417" />
<p:barcode value="0123456789" type="pdf417"/>
<h:outputText value="DataMatrix" />
<p:barcode value="0123456789" type="datamatrix"/>
<h:outputText value="Postnet" />
<p:barcode value="0123456789" type="postnet"/>
<h:outputText value="QR" />
<p:barcode value="0123456789" type="qr"/>
</p:panelGrid>
</h:body>
</html>
pom.xml
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.prime</groupId>
<artifactId>primedemop</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>primefaces</name>
<dependencies>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.2.2</version>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>2.2.2</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
</dependency>
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>5.1</version>
</dependency>
<dependency>
<groupId>net.glxn</groupId>
<artifactId>qrgen</artifactId>
<version>1.4</version>
</dependency>
</dependencies>![smaple][2]
</project>
I guess you're doing all ok.But you missed on one thing.The qrgen-1.4 you are using are further having dependencies as zxing-core-2.0 & zxing-javase trying including these two jar files into your build path these might work well.
这篇关于primefaces qr代码没有显示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!