Get the App
SLTechnology News&Howtos  ›  Development  › 

How to realize Color CAPTCHA Code by JSP

Shulou Source: shulou.com Published: 2022-06-02 12:33:40 10月02日 Update

This article is about how JSP implements color CAPTCHA. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

Generate a picture with 4 random numbers and a cluttered background, the number and background color will change, and the server will refresh (also change with history.go (- 1)).

The file http://blog.itpub.net/9650775/viewspace-922495/image.jsp that produces the CAPTCHA image

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 (rmae gpene b)

}

% >

Tags: Authentication validation image input picture number background page color generation color same content file more article system different good practical Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn Shulou Information MariaDB Apple NVidia