简体   繁体   中英

primefaces qr code not shown?

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>

我猜你一切都还好。但是你错过了一件事。你正在使用的qrgen-1.4进一步依赖zxing-core-2.0zxing-javase尝试将这两个jar文件包含在你的构建路径中这些可能有效好。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM