mirror of
https://github.com/whvcse/EasyCaptcha.git
synced 2024-11-14 21:59:19 +08:00
Update README.md
This commit is contained in:
parent
d2eebec71e
commit
da6e74a9fd
10
README.md
10
README.md
@ -54,12 +54,12 @@ dependencies {
|
||||
</servlet>
|
||||
<servlet-mapping>
|
||||
<servlet-name>CaptchaServlet</servlet-name>
|
||||
<url-pattern>/image/captcha</url-pattern>
|
||||
<url-pattern>/images/captcha</url-pattern>
|
||||
</servlet-mapping>
|
||||
```
|
||||
2.前端代码
|
||||
```html
|
||||
<img src="/image/captcha" />
|
||||
<img src="/images/captcha" />
|
||||
```
|
||||
|
||||
### 在*SpringMVC*中使用
|
||||
@ -77,7 +77,7 @@ public void captcha(HttpServletRequest request, HttpServletResponse response) {
|
||||
```
|
||||
前端代码:
|
||||
```html
|
||||
<img src="/image/captcha" />
|
||||
<img src="/images/captcha" />
|
||||
```
|
||||
|
||||
### 前后端分离中使用
|
||||
@ -97,7 +97,7 @@ public void captcha(String key, HttpServletRequest request, HttpServletResponse
|
||||
|
||||
前后端分离也同样可以使用框架自带的servlet,使用方式如下:
|
||||
```html
|
||||
<img src="/image/captcha?key=xxx" />
|
||||
<img src="/images/captcha?key=xxx" />
|
||||
<!-- 此处的key应该有js随机生成,并且js在验证的时候也需要传递这个key -->
|
||||
|
||||
```
|
||||
@ -131,4 +131,4 @@ CaptchaUtil captcha = new CaptchaUtil(130, 38, 5);
|
||||
CaptchaUtil captcha = new CaptchaUtil();
|
||||
captcha.setCodeName("captcha");
|
||||
```
|
||||
默认存在session中是以captcha为key存储的,存储在servletContext中是以captcha-xxx为key存储的,xxx是生成的时候前端传递的key。
|
||||
默认存在session中是以captcha为key存储的,存储在servletContext中是以captcha-xxx为key存储的,xxx是生成的时候前端传递的key。
|
||||
|
Loading…
Reference in New Issue
Block a user