1<?xml version="1.0" encoding="UTF-8"?> 2<!-- 3 Copyright 2008 ZXing authors 4 5 Licensed under the Apache License, Version 2.0 (the "License"); 6 you may not use this file except in compliance with the License. 7 You may obtain a copy of the License at 8 9 http://www.apache.org/licenses/LICENSE-2.0 10 11 Unless required by applicable law or agreed to in writing, software 12 distributed under the License is distributed on an "AS IS" BASIS, 13 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 14 See the License for the specific language governing permissions and 15 limitations under the License. 16 --> 17<jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"> 18<jsp:directive.page import=" 19 com.google.zxing.Result, 20 com.google.zxing.client.result.ResultParser, 21 com.google.zxing.client.result.ParsedResult, 22 com.google.zxing.web.OutputUtils, 23 com.google.common.xml.XmlEscapers"/> 24<jsp:directive.page contentType="text/html" session="false"/> 25<jsp:scriptlet> 26 response.setHeader("Cache-Control", "no-cache"); 27 response.setHeader("X-Robots-Tag", "none"); 28</jsp:scriptlet> 29<jsp:text><![CDATA[<!DOCTYPE html>]]></jsp:text> 30<html lang="en"> 31 <head> 32 <meta charset="UTF-8"/> 33 <meta name="robots" content="none"/> 34 <meta name="viewport" content="width=device-width, initial-scale=1.0"/> 35 <title>Decode Succeeded</title> 36 <link rel="stylesheet" href="style.css" type="text/css"/> 37 <style type="text/css"> 38 td { vertical-align: top; padding: 0.1in; background-color: #EEEEEE; font-family: monospace; } 39 </style> 40 </head> 41 <body> 42 <div id="main"> 43 <div id="header"><h1><img src="zxing-icon.png" id="icon" alt=""/> Decode Succeeded</h1></div> 44 <jsp:scriptlet> 45 @SuppressWarnings("unchecked") 46 Iterable<Result> results = (Iterable<Result>) request.getAttribute("results"); 47 for (Result result : results) { 48 ParsedResult parsedResult = ResultParser.parseResult(result); 49 50 String text = result.getText(); 51 if (text == null) { 52 text = "(Not applicable)"; 53 } else { 54 text = XmlEscapers.xmlContentEscaper().escape(text); 55 } 56 57 byte[] rawBytes = result.getRawBytes(); 58 String rawBytesString; 59 if (rawBytes == null) { 60 rawBytesString = "(Not applicable)"; 61 } else { 62 rawBytesString = OutputUtils.arrayToString(rawBytes); 63 } 64 65 String displayResult = parsedResult.getDisplayResult(); 66 if (displayResult == null) { 67 displayResult = "(Not applicable)"; 68 } else { 69 displayResult = XmlEscapers.xmlContentEscaper().escape(displayResult); 70 } 71 </jsp:scriptlet> 72 <table id="result"> 73 <tr> 74 <td>Raw text</td> 75 <td><pre><jsp:expression>text</jsp:expression></pre></td> 76 </tr> 77 <tr> 78 <td>Raw bytes</td> 79 <td><pre><jsp:expression>rawBytesString</jsp:expression></pre></td> 80 </tr> 81 <tr> 82 <td>Barcode format</td> 83 <td><jsp:expression>result.getBarcodeFormat()</jsp:expression></td> 84 </tr> 85 <tr> 86 <td>Parsed Result Type</td> 87 <td><jsp:expression>parsedResult.getType()</jsp:expression></td> 88 </tr> 89 <tr> 90 <td>Parsed Result</td> 91 <td><pre><jsp:expression>displayResult</jsp:expression></pre></td> 92 </tr> 93 </table> 94 <jsp:scriptlet> 95 } 96 </jsp:scriptlet> 97 </div> 98 </body> 99</html> 100</jsp:root> 101