使用QrCode类库生成简单的二维码方式
<html>
<head>
<base href="<%=basePath%>">
<title>My JSP 'index.jsp' starting page</title>
<meta http-equiv="pragma" content="no-cache">
<meta http-equiv="cache-control" content="no-cache">
<meta http-equiv="expires" content="0">
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="This is my page">
<!--
<link rel="stylesheet" type="text/css" href="styles.css">
-->
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/qrcode.js"></script>
<script type="text/javascript" src="js/jquery.qrcode.js"></script>
</head>
<body>
This is my JSP page. <br>
<div id="qrcodeTable" style="width: 200px;"></div>
<input name="aaa" type="button" onclick="createQrcode()"/>
<script>
function createQrcode() {
jQuery('#qrcodeTable').qrcode({
render : "canvas",
text : "http://www.baidu.com/s?word=你好&tn=91780252_hao_pg&ie=utf-8"
});
}
</script>
</body>
</html>