使用zxing生成二维码 扫二维码进行页面跳转问题

 @RequestMapping(value="createQRCode",  method = RequestMethod.GET)
    public void createQRCode(HttpServletRequest request, HttpServletResponse response) throws IOException {

        JSONObject json = new JSONObject();
        json.put("method", "get");
        json.put(
                "url",
                "https://www.baidu.com/");
        String content = json.toJSONString();// 内容
        Map<EncodeHintType, Object> hints = new HashMap<EncodeHintType, Object>();
        hints.put(EncodeHintType.CHARACTER_SET, "UTF-8");
        ServletOutputStream stream = response.getOutputStream();
        int width = 200; // 图像宽度
        int height = 200; // 图像高度
        QRCodeWriter writer = new QRCodeWriter();
        try {
            BitMatrix bitMatrix = writer.encode(content, BarcodeFormat.QR_CODE, width, height, hints);
            MatrixToImageWriter.writeToStream(bitMatrix, "jpeg", stream);// 输出图像
        } catch (WriterException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } finally {
            if (stream != null) {
                stream.flush();
                stream.close();
            }
        }       
    }

在扫二维码的时候,是跳转到了另一个界面,不过显示的是content数据,不知道是不是因为我没有给二维码添加他需要跳转到的页面的网址。我只能做到显示content数据。无法做到例如扫码调到百度网页这种功能

求大神帮忙!

已经找到问题所在了,因为之前 把 content="www.baidu.com"传的,但实际上 应该把 content="https://www.baidu.com/"
才能实现真正的自动跳转页面。主要就是要输入完整的网址

已经找到问题所在了,因为之前 把 content="www.baidu.com"传的,但实际上 应该把 content="https://www.baidu.com/"
才能实现真正的自动跳转页面。主要就是要输入完整的网址

你可以在生成的二维码中直接存放http链接地址试试。有些扫码工具会智能分辨的。