一. 登录验证码及校验
@WebServlet("/demo")
public class DemoServlet extends HttpServlet {
@Override
protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
//输出文字流
//PrintWriter out = resp.getWriter();
//获取响应流
ServletOutputStream os = resp.getOutputStream();
InputStream is = new FileInputStream(new File(getServletContext().getRealPath("images"),"a.png"));
int index = -1;
while((index=is.read())!=-1){
os.write(index);
}
}
}@WebServlet("/demo")
pu