JSP验证码的例子源码下载文件讲解

JSP验证码的例子源码下载文件讲解使用说明:

<%@ page contentType=”text/html; charset=gb2312″ language=”java” import=”java.sql.*” errorPage=”" %>
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=gb2312″ />
<title>无标题文档</title>
</head>

<body>
<%
String input = request.getParameter(“image”); //用户输入的验证码
String rand = (String)session.getAttribute(“VerifyCode”); //系统生成 的验证码
if(!rand.equals(input)){
out.print(“验证码不正确请重新输入”);
}else {
out.print(“恭喜!您输入了正确的验证码”);
}
%>
</body>
</html>

 

<%@ page contentType=”text/html; charset=gb2312″ language=”java” import=”java.sql.*” errorPage=”" %>
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<html xmlns=”http://www.w3.org/1999/xhtml”>
<head>
<meta http-equiv=”Content-Type” content=”text/html; charset=gb2312″ />
<title>无标题文档</title>
</head>

<body>

<form id=”form1″ name=”form1″ method=”post” action=”ceshi-check.jsp”>

<input name=”image” class=”dud_input1″ id=”image” style=”WIDTH: 50px; HEIGHT: 18px” size=”3″ />
<img src=”Code” onclick=”history.go(0)” title=”点击刷新验证码”/>
<input type=”submit” name=”Submit” value=”提交” />
</form>
</body>
</html>

1:首先把dreamtime这个文件夹复制到WEB-INF/classes/下

2:把web.xml复制到WEWB-INF/下

3:把ceshi-index.jsp和ceshi-check.jsp放到您应用的跟目录下

4:打开浏览器访问即可

JSP验证码的例源码下载 本文链接地址: JSP验证码的例子源码下载文件讲解