<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><metahttp-equiv="Content-Type"content="text/html; charset=UTF-8"><title>Insert title here</title></head><body><formaction="answer.jsp"method="post"><inputtype="text"name="guess"><inputtype="submit"value="提交"></form><%
String charString=newString("dfngfnkgnfdlkvFGCBVCBCV");
int charNum=(int)(Math.random()*100+1)%26-1;
Character tempCharacter=new Character(charString.charAt(charNum));
session.setAttribute("TempChar", tempCharacter);
%></body></html>
回复
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%><!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"><html><head><metahttp-equiv="Content-Type"content="text/html; charset=UTF-8"><title>Insert title here</title></head><body><%
String tempString=request.getParameter("guess");
String TempChar=session.getAttribute("TempChar").toString();
if(tempString !=null){
//忽略大小写
if(TempChar.equalsIgnoreCase(tempString)){
out.println("恭喜你猜对了");
}else{
out.println("SB");
}
}
%></body></html>