package com.rd.p2p.web;

import java.awt.BasicStroke;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.geom.AffineTransform;
import java.awt.geom.Line2D;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random; import javax.imageio.ImageIO;
import javax.servlet.ServletOutputStream; import org.apache.commons.lang3.StringUtils;
import org.apache.poi.ss.formula.functions.T;
import org.apache.struts2.convention.annotation.Action; import com.alibaba.fastjson.JSON;
import com.rd.p2p.additional.redisCaptcha.util.ResponseUtil;
import com.rd.p2p.common.util.redis.RedisValidImgCodeUtils;
import com.rd.p2p.core.core.Global;
import com.rd.p2p.core.core.constant.Constant;
import com.rd.p2p.core.core.web.BaseAction; public class CodeAction extends BaseAction<T> { private static final String KEY = "randomCode";
//点选文字图片验证码刷新次数
private static final String KEY_TOTAL = "select_random_code_total";
//点选文字图片验证码验证通过次数
private static final String KEY_SUCC = "select_random_code_succ";
//点选文字图片验证码验证失败次数
private static final String KEY_FAIL = "select_random_code_fail";
//缓存时间单位秒 设置成7天
private static final int CACHE_SECONDS = 604800;
//定义点选文字图片验证码允许的误差值
private static final int ERROR_AMOUNT = 12;// 定义允许的误差值,单位是px
//生成汉字的个数
private static Integer[] arr = new Integer[] {1, 2, 3, 4, 5};
//汉字颜色随机范围
private static Color[] colors = {Color.GRAY, Color.LIGHT_GRAY, Color.CYAN}; /**
* 跳转页面
* @return
*/
@Action("/verification")
public String verification() {
request.setAttribute("web_url", Global.getString("web_url"));
return "verification";
} /**生成验证码
* @param src
* @param x
* @param y
*/
@Action("/code/getVerificationCode")
public void readUsingImageReaderBigcH() {
ServletOutputStream outStream = null;
try {
// http://localhost:8080/gtop/img/149679.jpg
//String url = "d:/4.png";
//url = request.getSession().getServletContext().getRealPath("") + url;
/* InputStream source = new FileInputStream(src);
BufferedImage image = null;
image = ImageIO.read(source);*/ //生成背景图片
BufferedImage image = getBackGround();
int hight = image.getHeight();
Graphics graphics = image.getGraphics();
// 设置颜色
graphics.setColor(Color.red);
graphics.setFont(new Font("宋体", Font.BOLD, 30)); StringBuilder sb = new StringBuilder();
Random random = new Random(); //转成集合
List<Integer> intList = Arrays.asList(arr);
//重新随机排序
Collections.shuffle(intList); //list参数坐标参数 用于校验是否验证通过
List<String> codeList = new ArrayList<String>(); int x = 0;
int y = 0; //定义随机1到arr.length某一个字不参与校验
int num = random.nextInt(arr.length)+1; for (int i = 0; i < arr.length; i++) { // 5个汉字,只点4个
String ch = getRandomChineseChar(); int place = intList.get(i);
if (place == 1) {
x = new Random().nextInt(30) + 40; // 自己定义的位子坐标
y = new Random().nextInt(30) + 40; // i=1的时候,y的值
}
if (place == 2) {
x = new Random().nextInt(40) + 120; // 自己定义的位子坐标
y = new Random().nextInt(30) + 50; // i=2的时候,y的值
}
if (place == 3) {
x = new Random().nextInt(70) + 200; // 自己定义的位子坐标
y = new Random().nextInt(50) + 100; // i=3的时候,y的值
}
if (place == 4) {
x = new Random().nextInt(70) + 80; // i=4的时候,x的值
y = new Random().nextInt(30) + 90; // 自己定义的位子坐标
}
if (place == 5) {
x = new Random().nextInt(70) + 180; // i=4的时候,x的值
y = new Random().nextInt(30) + 50; // 自己定义的位子坐标
} Constant.LOGGER.info("x:" + x + ",y:" + y + ",hight:" + hight);
//字体颜色
graphics.setColor(colors[random.nextInt(colors.length)]);
graphics.drawString(ch, x, y);
if (place != num) {
sb.append(ch);
codeList.add(x + "_" + y); // jsp页面坐标原点在字的中间,drawString方法坐标原点在中间
}
} Constant.LOGGER.info("汉字:" + sb);
//放入session
//将产生的随机汉字验证码存进session中进行保存
String sessionid = request.getSession().getId();
RedisValidImgCodeUtils.save(sessionid + KEY, codeList);
//增加验证码请求次数
RedisValidImgCodeUtils.increment(KEY_TOTAL, CACHE_SECONDS); // 可以将图片合并传入前端 也可以直接传数据汉字给前端
// 创建顶部图片
BufferedImage bi = new BufferedImage(image.getWidth(), 25, BufferedImage.TYPE_INT_RGB);
Graphics gra = bi.getGraphics(); // 设置背景颜色
gra.setColor(Color.WHITE);
// 填充区域
gra.fillRect(0, 0, bi.getWidth(), bi.getHeight()); // 设置边框颜色
gra.setColor(Color.BLUE);
// 设置边框区域
gra.drawRect(1, 1, bi.getWidth() - 2, bi.getHeight() - 2); // 设置文字背景颜色
Font font = new Font("Microsoft YaHei", Font.BOLD, 16);
gra.setFont(font);
gra.setColor(Color.BLACK);
gra.drawString("按顺序点击:" + sb.toString(), (bi.getWidth() - 10*font.getSize())/2, bi.getHeight()/2 + font.getSize()/2);//设置文字字体 与位子 居中 BufferedImage combined = new BufferedImage(image.getWidth(), image.getHeight() + bi.getHeight(), BufferedImage.TYPE_INT_RGB); Graphics g = combined.getGraphics(); //合并
g.drawImage(bi, 0, 0, null);
g.drawImage(image, 0, bi.getHeight(), null);
outStream= response.getOutputStream();
ImageIO.write(combined, "jpg", outStream);
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
if (outStream != null) {
outStream.close();
}
} catch (IOException e) {
e.printStackTrace();
}
}
} @Action("/code/verify")
public void verify() throws IOException {
Map<String, Object> data = new HashMap<String, Object>();
data.put("result", false);
String value = request.getParameter("code");
String sessionid = request.getSession().getId();
if (RedisValidImgCodeUtils.get(sessionid + KEY) == null) {
printWebJson(JSON.toJSONString(data));
return;
}
List<String> sValue = (List<String>) RedisValidImgCodeUtils.get(sessionid + KEY); //取到数据后直接清掉redis
RedisValidImgCodeUtils.del(sessionid + KEY); Constant.LOGGER.info("**前端请求数据***"+value);
Constant.LOGGER.info("**后端实际数据**"+sValue.toString()); //为null 或者"" 或者 " "
if (StringUtils.isBlank(value) || sValue == null || sValue.size() < 1) {
printWebJson(JSON.toJSONString(data));
return;
} String [] valueStr = value.split(",");
if(valueStr.length != sValue.size() || valueStr.length != 4){
printWebJson(JSON.toJSONString(data));
return;
} /*判断坐标参数是否正确*/
String str = "";
for (int i = 0; i < valueStr.length; i++) {
str = valueStr[i].toString();
if(StringUtils.isBlank(str) || StringUtils.isBlank(sValue.get(i).toString())){
printWebJson(JSON.toJSONString(data));
return;
}
String [] vL = valueStr[i].toString().split("_");
String [] svL = sValue.get(i).toString().split("_");
if(vL.length != svL.length || svL.length != 2){
printWebJson(JSON.toJSONString(data));
return;
}
//x轴 y轴判断 坐标点在左上角 ,图片宽度30px 点击范围扩大12px, 范围在 x-13 < x <x+13 ;
if(!(Integer.parseInt(svL[0])-ERROR_AMOUNT < Integer.parseInt(vL[0])-15 && Integer.parseInt(vL[0])-15 < Integer.parseInt(svL[0])+ERROR_AMOUNT )
|| !(Integer.parseInt(svL[1])-ERROR_AMOUNT < Integer.parseInt(vL[1])-15 && Integer.parseInt(vL[1])-15 < Integer.parseInt(svL[1])+ERROR_AMOUNT)){
//增加验证失败次数
RedisValidImgCodeUtils.increment(KEY_FAIL, CACHE_SECONDS);
printWebJson(JSON.toJSONString(data));
return;
}
}
//增加验证通过次数
RedisValidImgCodeUtils.increment(KEY_SUCC, CACHE_SECONDS);
data.put("result", true);
printWebJson(JSON.toJSONString(data));
} /**
* 生成背景图片
* @return
*/
public BufferedImage getBackGround(){
int width=300; //指定生成验证码的宽度
int height=200; //指定生成验证码的高度
BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
Graphics g = image.getGraphics();
Graphics2D g2d = (Graphics2D)g; //创建Graphics2D对象
Random random = new Random();
// Font mFont = new Font("黑体", Font.BOLD, 16); //定义字体样式
// g.setColor(getRandColor(200, 250)); //背景色
g.fillRect(0, 0, width, height); //绘制背景
// g.setFont(mFont); //设置字体
g.setColor(getRandColor(180, 200)); //线条色 //绘制88根位置和颜色全部为随机产生的线条,该线条为2f
for (int i = 0; i < 88; i++) {
int x = random.nextInt(width-1);
int y = random.nextInt(height-1);
int x1 = random.nextInt(100)+1;
int y1 = random.nextInt(120)+1;
BasicStroke bs = new BasicStroke(2f,BasicStroke.CAP_BUTT,BasicStroke.JOIN_BEVEL);
Line2D line = new Line2D.Double(x,y,x+x1,y+y1);
g2d.setStroke(bs);
g2d.draw(line); //绘制直线
// g2d.setColor(getRandColor(random, 30, 150)); //随机每条线条的颜色
} //输出生成的验证码图片
g.dispose();
return image;
} private static Color getRandColor(Random random, int fc, int bc){
if (fc > 255)
fc = 255;
if (bc > 255)
bc = 255;
int r = fc + random.nextInt(bc - fc);
int g = fc + random.nextInt(bc - fc);
int b = fc + random.nextInt(bc - fc);
return new Color(r, g, b);
} private static String[] generateCheckCode() {
String[] res = new String[2];
Random random = new Random();
int intTemp;
int intFirst = random.nextInt(100);
int intSec = random.nextInt(100);
String checkCode = "";
int result = 0;
switch (random.nextInt(6)) {
case 0:
if (intFirst < intSec) {
intTemp = intFirst;
intFirst = intSec;
intSec = intTemp;
}
checkCode = intFirst + " - " + intSec + " = ?";
result = intFirst-intSec;
break;
case 1:
if (intFirst < intSec) {
intTemp = intFirst;
intFirst = intSec;
intSec = intTemp;
}
checkCode = intFirst + " - ? = "+(intFirst-intSec);
result = intSec;
break;
case 2:
if (intFirst < intSec) {
intTemp = intFirst;
intFirst = intSec;
intSec = intTemp;
}
checkCode = "? - "+intSec+" = "+(intFirst-intSec);
result = intFirst;
break;
case 3:
checkCode = intFirst + " + " + intSec + " = ?";
result = intFirst + intSec;
break;
case 4:
checkCode = intFirst + " + ? ="+(intFirst+intSec);
result = intSec;
break;
case 5:
checkCode = "? + " + intSec + " ="+(intFirst+intSec);
result = intFirst;
break;
}
res[0] = checkCode;
res[1] = String.valueOf(result);
Constant.LOGGER.info("result=" + result);
return res;
} @Action("/code/calc")
public void calcCode() throws IOException{
int width = 140, height = 37;
try {
BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
Graphics g = image.getGraphics();
Random random = new Random();
g.setColor(getRandColor(random, 200, 250));
g.fillRect(0, 0, width, height); String[] fontTypes = { "\u5b8b\u4f53", "\u65b0\u5b8b\u4f53", "\u9ed1\u4f53", "\u6977\u4f53", "\u96b6\u4e66" };
int fontTypesLength = fontTypes.length; g.setColor(getRandColor(random, 160, 200));
g.setFont(new Font("Times New Roman", Font.PLAIN, 14 + random.nextInt(6))); for (int i = 0; i < 255; i++) {
int x = random.nextInt(width);
int y = random.nextInt(height);
int xl = random.nextInt(12);
int yl = random.nextInt(12);
g.drawLine(x, y, x + xl, y + yl);
} String[] result = generateCheckCode();
RedisValidImgCodeUtils.save(request.getSession().getId() + "calc_code", result[1]);
String [] baseChar = result[0].split(" ");
for (int i = 0; i < baseChar.length; i++) {
g.setColor(getRandColor(random, 30, 150));
g.setFont(new Font(fontTypes[random.nextInt(fontTypesLength)], Font.BOLD, 22 + random.nextInt(6)));
g.drawString(baseChar[i], 24 * i + 10, 24);
}
g.dispose();
//发送图片
ResponseUtil.sendImg(response, image, "image/jpeg", "code", "jpg");
} catch (IllegalStateException e) {
Constant.LOGGER.error(e.getMessage());
e.printStackTrace();
}
} @Action("/code/getRandomCode")
public void getRandomCode() throws IOException{
// TODO Auto-generated method stub
//设置不缓存图片
response.setHeader("Pragma", "No-cache");
response.setHeader("Cache-Control", "No-cache");
response.setDateHeader("Expires", 0);
//指定生成的响应图片
response.setContentType("image/jpeg");
int width=140; //指定生成验证码的宽度
int height=37; //指定生成验证码的高度
BufferedImage image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
Graphics g = image.getGraphics();
Graphics2D g2d = (Graphics2D)g; //创建Graphics2D对象
Random random = new Random();
Font mFont = new Font("黑体", Font.BOLD, 22); //定义字体样式
g.setColor(getRandColor(200, 250));
g.fillRect(0, 0, width, height); //绘制背景
g.setFont(mFont); //设置字体
g.setColor(getRandColor(180, 200)); //绘制100根位置和颜色全部为随机产生的线条,该线条为2f
for (int i = 0; i < 100; i++) {
int x = random.nextInt(width-1);
int y = random.nextInt(height-1);
int x1 = random.nextInt(6)+1;
int y1 = random.nextInt(12)+1;
BasicStroke bs = new BasicStroke(2f,BasicStroke.CAP_BUTT,BasicStroke.JOIN_BEVEL);
Line2D line = new Line2D.Double(x,y,x+x1,y+y1);
g2d.setStroke(bs);
g2d.draw(line); //绘制直线
} //输出由英文,数字和中文随机组成的验证文字,具体的组合方式根据生成随机数确定
String sRand = "";
//输出随机的验证文字
String ctmp = "";
int itmp = 0;
for(int i = 0;i<4;i++){
switch (random.nextInt(2)) {
case 0:
itmp = random.nextInt(26)+65; //生成A~Z的字母
ctmp = String.valueOf((char)itmp);
break;
default:
ctmp = String.valueOf(random.nextInt(8)+2); //生成2~9的数字
break;
}
sRand+=ctmp;
Color color = new Color(20+random.nextInt(110), 20+random.nextInt(110), 20+random.nextInt(110));
g.setColor(color); //将生成的随机数进行随机缩放病旋转指定角度
//将文字旋转指定角度
Graphics2D g2d_word = (Graphics2D)g;
AffineTransform trans = new AffineTransform();
trans.rotate(random.nextInt(45)*3.14/180, 15*i+8, 7);
//缩放文字
/*float scaleSize = random.nextFloat()+0.8f;
if(scaleSize > 1f){
scaleSize = 1f;
}
trans.scale(scaleSize, scaleSize); */
g2d_word.setTransform(trans);
g.drawString(ctmp, 20*i+18, 18); //每个字的间距xy
}
//将生成的验证码保存道session中
RedisValidImgCodeUtils.save(request.getSession().getId() + "randCheckCode", sRand); //输出生成的验证码图片
g.dispose();
ImageIO.write(image, "JPEG", response.getOutputStream());
} public Color getRandColor(int s,int e){
Random random = new Random();
if(s>255)s = 255;
if(e>255)e = 255;
int r = s+random.nextInt(e-s);
int g = s+random.nextInt(e-s);
int b = s+random.nextInt(e-s);
return new Color(r, g, b);
} public static String getRandomChineseChar() {
String str = null;
int hs, ls;
Random random = new Random();
hs = (176 + Math.abs(random.nextInt(39)));
ls = (161 + Math.abs(random.nextInt(93)));
byte[] b = new byte[2];
b[0] = (new Integer(hs).byteValue());
b[1] = (new Integer(ls).byteValue());
try {
str = new String(b, "GBk"); //转成中文
} catch (UnsupportedEncodingException ex) {
ex.printStackTrace();
}
return str;
} }
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width,initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
<script src="${web_url}/api/themes/theme_default/media/js/jquery.js"></script>
<title>验证码</title>
</head>
<body>
<div style="text-align:center;position:relative;">
<!--<h2>这是点击的验证码</h2> -->
<!-- 这是点击的验证码 -->
<img id="codeT3" src="${web_url}/api/code/getVerificationCode.html?flag=" +Math.random()"/>
</br>
<!--
<input type="button" value="刷新" onclick="getCodeTree();" />
        
<input type="button" value="校验" onclick="cheakOutTree();" />
-->
<select id="codeSelect" style="display: none;"></select>
<img src="${web_url}/api/refresh.png" style="position:absolute;right:0;top:0; width:20px; height: 20px;" onclick="getCodeTree();" />
</div> <script type="text/javascript">
//点击次数
var number=0; //获取验证码3
function getCodeTree() {
number = 0;
$(".zhezhao").remove();
document.getElementById("codeSelect").options.length = 0;
$("#codeT3").attr("src","${web_url}/api/code/getVerificationCode.html?flag="+Math.random());
} $(function() {
$("#codeT3").bind("click", function(ev) {
var oEvent = ev || event;
//var number = $("#codeSelect option").length;
number++; if (number > 4) {
return;
} var x = oEvent.pageX;
var y = oEvent.pageY;
var img = document.getElementById('codeT3'); //获取图片的原点
var nodex = getNodePosition(img)[0];//原点x 与原点y
var nodey = getNodePosition(img)[1]; var xserver = parseInt(x) - parseInt(nodex);
var yserver = parseInt(y) - parseInt(nodey); $("#codeSelect").append(
"<option value='"+ (parseInt(number)+1) +"'>" + xserver + "_" + yserver
+ "</option>");
var oDiv = document.createElement('img');
oDiv.style.left = (parseInt(x)-15) + 'px'; // 指定创建的DIV在文档中距离左侧的位置 图片大小30 左右移动5
oDiv.style.top = (parseInt(y) -15) + 'px'; // 指定创建的DIV在文档中距离顶部的位置
oDiv.style.border = '1px solid #FF0000'; // 设置边框
oDiv.style.position = 'absolute'; // 为新创建的DIV指定绝对定位
oDiv.style.width = '30px'; // 指定宽度
oDiv.style.height = '30px'; // 指定高度
//oDiv.src = 'select.png';
oDiv.style.opacity = '0.5'; //透明度
oDiv.className = 'zhezhao';//加class 点刷新后删除遮罩
document.body.appendChild(oDiv); //第四次点击后自动提交
if (number == 4) {
cheakOutTree();
} }); }) //校验验证码
function cheakOutTree() {
var txt = "";
$("#codeSelect option").each(function (){
var text = $(this).text();
if(txt == ""){
txt = text;
}else{
txt = txt + "," + text;
}
});
$.ajax({
type:"post",
url:"${web_url}/api/code/verify.html",
data : {"code" : txt},
cache : false,
success : function(data) {
alert(data.result);
if (!data.result) {
getCodeTree();
}
}
});
} function getNodePosition(node) {
var top = left = 0;
while (node) {
if (node.tagName) {
top = top + node.offsetTop;
left = left + node.offsetLeft;
node = node.offsetParent;
}
else {
node = node.parentNode;
}
}
return [left, top];
} </script> </body>
</html>

  

java实现点选汉字验证码(转)的更多相关文章

  1. java实现点选汉字验证码

    package com.rd.p2p.web; import java.awt.BasicStroke; import java.awt.Color; import java.awt.Font; im ...

  2. java实现点选汉字验证码(自己修改后的)

    参考:http://blog.csdn.net/qq_26680031/article/details/51168527 package com.rd.p2p.web; import java.awt ...

  3. Java随机生成常用汉字验证码

    原文:http://www.open-open.com/code/view/1422514803970 import java.awt.Color; import java.awt.Font; imp ...

  4. java验证码-汉字验证码

    今天整理了一个java实现的汉字输入验证码 主要包含两个类,一个是生成验证码,一个是判断验证码输入是否正确 实现原理非常简单,将汉字和干扰线生成图片并将汉字保存到session,前台获取每次生成验证码 ...

  5. 字母数字、字母、汉字验证码 (java)

    原文:http://blog.csdn.net/qh_java/article/details/49854477 一.字母数字,字母,汉字验证码的生成代码 1.字母数字验证码: package com ...

  6. PHP算式验证码和汉字验证码的实现方法

    在PHP网站开发中,验证码可以有效地保护我们的表单不被恶意提交,但是如果不使用算式验证码或者汉字验证码,仅仅使用简单的字母或者数字验证码,这样的验证码方案真的安全吗? 大家知道简单数字或者字母验证码很 ...

  7. java判断是否为汉字

    java判断是否为汉字   public static boolean isChinese(String str) { String regEx = "[\u4e00-\u9fa5]&quo ...

  8. selenium+java破解极验滑动验证码的示例代码

    转自: https://www.jianshu.com/p/1466f1ba3275 selenium+java破解极验滑动验证码 卧颜沉默 关注 2017.08.15 20:07* 字数 3085  ...

  9. 极验验证使用-滑动&选字验证码

    准备 SDK下载 首先在极验官网下载好SDK,附上官网链接,点此可直接下载python版zip包. 模块安装 使用该SDK时发现它依赖两个模块,分别是geetest和requests. pip ins ...

随机推荐

  1. JavaScript 输入小数点(event.key或event.code)

    1. 概述 1.1 说明 在开发过程中,有时候需要仅输入数字与小数,故记录下使用过的功能,以便后期使用. 1.2 key 定义:按下按键时返回的标识符,按键标识符是表示键盘按钮的字符串(如1,2,a等 ...

  2. Dnsmasq加速本地DNS请求

    文章目录 Dnsmasq安装 Dnsmasq配置 Dnsmasq启动 Dnsmasq使用 Dnsmasq小结   默认的情况下,我们平时上网用的本地DNS服务器都是使用电信或者联通的,但是这样也导致了 ...

  3. ORACLE环境变量定义

    export在linux的bash中可以理解为设置环境变量.设置后能够被当前的shell及子shell使用. 这些变量的含义有一些有意义,可以查看相应的文档,我给你解释一些我知道的: ORACLE_H ...

  4. Confluence 6 用户目录图例 - Confluence 内部目录

    上面的图:Confluence 使用内部目录为用户管理. https://www.cwiki.us/display/CONFLUENCEWIKI/Diagrams+of+Possible+Config ...

  5. ionic3 使用html2canvas将数据导出为图片,并下载本地

    1.安装html2canvas npm install --save html2canvas 官方网站 https://html2canvas.hertzen.com/ 2.在需要的组件中引入html ...

  6. Vue+restfulframework示例

    一.简单回顾vue 前不久我们已经了解了vue前端框架,所以现在强调几点: 修改源: npm config set registry https://registry.npm.taobao.org 创 ...

  7. 动态获取后台传过来的值作为select选项

    问题描述:点击左侧菜单项,进入对应的具体页面a.html,页面上方有个select框,点击框后,会浮现选择项. 解决思路:对左侧菜单项添加一个onclick事件,进入后台做具体的查询,将查询到的lis ...

  8. Deal with Warning: mysqli::__construct(): (HY000/2002)

    1.安装XAMPP之后,如果之前安装过MySQL或者 apache,启动XAMPP中的响应的服务的时候回出现报错, 出错的原因,具体看报错的原因,如果是端口占用,在配置中修改端口号,如果是提示 “Fo ...

  9. tomcat启动报错:Annotation-specified bean name 'patrolTrailServiceImpl' for bean class [cn.oppo.inventoryService.patrolTrailServiceImpl] con

    注释-为bean类[目录服务patrolTrailServiceImpl]指定的bean名称“patrolTrailServiceImpl”与同名和[目录服务patrolTrailServiceImp ...

  10. ajax---异步请求对象的属性和方法

    方法: 1).open(method.url,asyn):创建请求,(post.get)asyn:表示同步(false)还是异步(true)提交 ,默认true 2)send(body) 发送请求,b ...