Verification Code Login session load later than JSP solution

Source: Internet
Author: User

When the page loads, the JSP page is loaded first, and the session is not loaded to the page, using <input type= "text" value= "${code}"/> to display null.

In fact, the sesion has been loaded into the scope. Online to see a processing method is to use JS to generate a verification code, the value can be directly obtained in the JSP, but this will lose the meaning of verification, through the packet can be read directly to the verification code. Do not distinguish between machine and human function.

protected void Service (HttpServletRequest req, HttpServletResponse resp)
Throws Servletexception, IOException {
Object attribute = Request.getsession (). getattribute ("code");

Verify in the Commit method, jump to the user name and password in the checksum servlet, through Request.getsession (). getattribute ("code"); Method gets the value of the session. To compare the value of input in the page. Failure returns a text CAPTCHA error.

Verification Code Login session load later than JSP solution

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.