../Kaptcha和参数img
来源:3-4 引入kaptcha实现验证码
电磁护盾
2020-12-22 21:45:36
1、shopoperation.html 中的 src="../Kaptcha" 是指向web.xml中的Kaptcha这个<Servlet>吗?
2、../返回上级目录,上级目录中包含web.xml文件,但是这里直接写../Kaptcha 就会自动钻入web.xml文件内部去找Servlet吗?
3、common.js中的img.src = "../Kaptcha?" + Math.floor(Math.random() * 100); 也是指向web.xml中的Kaptcha这个<Servlet>吗?
4、但是common.js文件的上级目录中没有web.xml文件啊,怎么会找到web.xml中的Kaptcha这个<Servlet>?
5、common.js文件中的changeVerifyCode(img)方法中的参数img的写法是固定的吗?参数img是指shopoperation.html中的<img>标签吗?<img>标签是个对象吗?
1回答
同学你好,
1、shopoperation.html中的 src="../Kaptcha" 是指向web.xml中url-pattern中的/Kaptcha。
如下:
2、../是返回当前请求的路径的上一级。
3、common.js中的img.src = "../Kaptcha?" + Math.floor(Math.random() * 100); 也是指向web.xml中url-pattern中的/Kaptcha。
4、../是返回当前请求的路径的上一级,不是返回上一级目录。
5、changeVerifyCode(img)方法中img是参数,表示changeVerifyCode方法接收一个参数。img是自定义的,如同学可以将img改为data。 参数值的是<img>标签。<img>标签是个对象。
同学可以回顾一下之前Servlet课程 https://class.imooc.com/course/715
相似问题