In the form
[Html]
<Form name = "infof">
<Font color = "red"> name: </font> <input name = "name" type = "text"> </input> <br>
<Font color = "red"> password: </font> <input name = "password" type = "password"> </input> <br>
Verification Code: <input name = "validate" type = "text">
<A href = "JavaScript: refresh ()"> you cannot see it clearly. Change it to another one. </a>
<Br>
<Input type = "button" onclick = "login ()" value = "login"> <input
Type = "reset">
</Form>
In the verification code image, validate. jsp is called to generate the verification code image. The content in this jsp is as follows:
[Html]
<Body>
<%
Response. setHeader ("Pragma", "No-cache ");
Response. setHeader ("Cache-Control", "no-cache ");
Response. setDateHeader ("Expires", 0 );
BufferedImage image = new BufferedImage (75, 30,
BufferedImage. TYPE_INT_RGB );
Graphics g = image. getGraphics ();
G. setColor (Color. gray );
G. fillRect (0, 0, 75, 30 );
String randStr = String. valueOf (new Random (). nextInt (8999) + 1000 );
Session. setAttribute ("randStr", randStr );
G. setColor (Color. black );
G. setFont (new Font ("", Font. PLAIN, 20 ));
G. drawString (randStr, 10, 20 );
For (int I = 1; I <= 120; I ++ ){
Int x = new Random (). nextInt (75 );
Int y = new Random (). nextInt (30 );
G. setColor (Color. blue );
G. drawOval (x, y, 1, 1 );
}
ImageIO. write (image, "JPEG", response. getOutputStream ());
Out. clear ();
Out = pageContext. pushBody ();
%>
</Body>
Okay, now we have a big show.
In
<A href = "JavaScript: refresh ()"> you cannot see it clearly. Change it to another one. </a>
Both the link and onclick methods refer to a method in js.
The details are as follows:
[Javascript]
<Script type = "text/javascript">
Function refresh (){
Infof. vali. src = "";
Infof. vali. src = "validate. jsp ";
}
</Script>
Originally, infof. vali. src = ""; I don't have this statement. When I click images or links, I find that validate. jsp is not called. No matter how I set the cache settings (maybe I have not set it to the point)
I tried to solve the problem of invalid Verification Code refresh.
After testing, you can link and click images ~~~ Problem Solving
From MELEARNER's column