随笔分类 - JavaWeb
摘要:1.验证码的代码是在网上搜罗的,是底纹乱线类的数字验证:authcode.jsp: 每次调用都会在 session 中添加一个属性,验证用户输入是否正确是只需再取出和输入内容比较即可<%@ page contentType="image/JPEG" import="java.awt.*,java.awt.image.*,java.util.*,javax.imageio.*" pageEncoding="GBK"%><%!Color getRandColor(int fc, int bc) {//给定范围获得随机颜色
阅读全文
摘要:存CookieCookie idCookie = new Cookie("userId", request.getParameter("id"));Cookie psdCookie = new Cookie("psd", request.getParameter("psd"));idCookie.setMaxAge(3600);//存3600秒也就是1小时psdCookie.setMaxAge(3600);response.addCookie(idCookie);response.addCookie(psdCook
阅读全文
摘要:配置/WEB-INF/web.xml文件: <servlet> <servlet-name>count</servlet-name> <jsp-file>/WEB-INF/count.jsp</jsp-file> <init-param> <param-name>driver</param-name> <param-value>org.git.mm.mysql.Driver</param-value> </init-param> <init-param>
阅读全文
摘要:<%@ page language="java" import="java.util.*" pageEncoding="GBK"%><%@ page contentType="text/html; charset=GBK" %><%@page import="java.math.BigInteger"%><%@page import="java.io.File"%><%@page import="java.io.
阅读全文
摘要:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html> <head> <title>输入需保存的内容</title> <meta http-equiv="content-type" content="text/html; charset=GBK"> </head> <body> <form action="fileoperate.jsp&qu
阅读全文