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