primefaces qr代码没有显示?

Ank*_*rma 5 java jsf maven primefaces jsf-2

我正在使用primefaces来开发一个网络应用程序.我正在尝试在网页上显示条形码.除QR码外,所有编码器都显示出来.我已经读过这个需要两个jar文件 样品

  • 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>
Run Code Online (Sandbox Code Playgroud)

但我得到第二依赖的错误所以我复制了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: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>
Run Code Online (Sandbox Code Playgroud)

的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>
Run Code Online (Sandbox Code Playgroud)

Tec*_*ain 3

我想你一切都好。但是你错过了一件事。你正在使用的 qrgen-1.4 进一步具有依赖关系,如zxing-core-2.0zxing-javase尝试将这两个 jar 文件包含到你的构建路径中,这些可能会起作用出色地。