//CheckLogin.java
package com.checkcode.servlet;
import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class CheckLogin extends HttpServlet
{
/** * Constructor of the object. */
public CheckLogin()
{
super();
}
/** * Destruction of the servlet. <br> */
public void destroy()
{
super.destroy();
// Just puts "destroy" string in log
// Put your code here
}
public void doGet(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException
{
String validatecode1=(String)request.getSession().getAttribute("ValidateCode"); //
String validatecode2=request.getParameter("validatecode"); //
if(!validatecode1.equals(validatecode2))
{ //
request.setAttribute("message", "验证错误");
}
else
{
request.setAttribute("message", "验证正确");
} //
request.getRequestDispatcher("/0login1.jsp").forward(request, response);
}
public void doPost(HttpServletRequest request, HttpServletResponse response)throws ServletException, IOException
{
doGet(request,response);
}
public void init() throws ServletException
{
// Put your code here
}
}
//Calendar.html
<html>
<head>
<title>万年历</title>
</head>
<body>
<center>
<applet code=CalendarApplet.class width=360 height=320>
</applet>
</center>
</body>
</html>