没有合适的资源?快使用搜索试试~ 我知道了~
做设计时用到的。
资源推荐
资源详情
资源评论
简单的登录页面(代码并不完整,只有验证码部分)
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>验证码</title>
<script type="text/javascript">
<span style="white-space:pre"></span><span style="white-space:pre"> </span> //刷新验证码的js函数
<span style="white-space:pre"> </span>function changeCode() {
<span style="white-space:pre"> </span>var imgNode = document.getElementById("vimg");
<span style="white-space:pre"> </span>//重新加载验证码,达到刷新的目的
<span style="white-space:pre"> </span>imgNode.src = "servlet/AuthImageServlet?t=" + Math.random(); // 防止浏览器缓存的问题
<span style="white-space:pre"> </span>}
</script>
</head>
<body>
<form action="checkServlet" method="post">
<label>输入验证码</label>
<input type="text" name="randomCode"/><img id="vimg" title="点击更换" onclick="changeCode();" src="servlet/AuthImageServlet">
<input type="submit" value="submit">
</form>
</body>
</html>
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.util.Random;
import javax.imageio.ImageIO;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
public class AuthImageServlet extends HttpServlet {
private static final String CONTENT_TYPE = "text/html; charset=gb2312";
//设置字母的大小,大小
private Font mFont = new Font("Times New Roman", Font.PLAIN, 17);
public void init() throws ServletException
{
super.init();
}
Color getRandColor(int fc,int bc)
{
Random random = new Random();
if(fc>255) fc=255;
if(bc>255) bc=255;
int r=fc+random.nextInt(bc-fc);
int g=fc+random.nextInt(bc-fc);
int b=fc+random.nextInt(bc-fc);
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.util.Random;
import javax.imageio.ImageIO;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
public class AuthImageServlet extends HttpServlet {
private static final String CONTENT_TYPE = "text/html; charset=gb2312";
//设置字母的大小,大小
private Font mFont = new Font("Times New Roman", Font.PLAIN, 17);
public void init() throws ServletException
{
super.init();
}
Color getRandColor(int fc,int bc)
{
Random random = new Random();
if(fc>255) fc=255;
if(bc>255) bc=255;
int r=fc+random.nextInt(bc-fc);
int g=fc+random.nextInt(bc-fc);
int b=fc+random.nextInt(bc-fc);
剩余7页未读,继续阅读
资源评论
大Q巴
- 粉丝: 0
- 资源: 3
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功