新学的代码
来源:互联网 发布:zabbix mysql启动失败 编辑:程序博客网 时间:2024/05/16 14:56
public class CacheTestServlet extends HttpServlet {
/**
* Constructor of the object.
*/
public CacheTestServlet() {
super();
}
/**
* Destruction of the servlet. <br>
*/
public void destroy() {
super.destroy(); // Just puts "destroy" string in log
// Put your code here
}
/**
* The doGet method of the servlet. <br>
*
* This method is called when a form has its tag value method equals to get.
*
* @param request the request send by the client to the server
* @param response the response send by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
*/
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
this.doPost(request, response);
}
/**
* The doPost method of the servlet. <br>
*
* This method is called when a form has its tag value method equals to post.
*
* @param request the request send by the client to the server
* @param response the response send by the server to the client
* @throws ServletException if an error occurred
* @throws IOException if an error occurred
*/
public void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=utf-8");
//禁止浏览器缓存当前的文档
response.setDateHeader("Expires", 0);
response.setHeader("Cache-Control", "no-Cache");
response.setHeader("Pragma", "no-Cache");
PrintWriter out = response.getWriter();
out.println("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">");
out.println("<HTML>");
out.println(" <HEAD><TITLE>A Servlet</TITLE></HEAD>");
out.println(" <BODY>");
out.println("本次响应的随机数:"+Math.random());
//产生一个form表单
out.println("<form action='NoServlet' method='POST'>");
out.println("第一个参数:<input type='text' name='p1'><br/>");
out.println("第二个参数:<textarea name='p2'></textarea><br/>");
out.println("<input type='submit' value='提交'></form>");
out.println(" </BODY>");
out.println("</HTML>");
out.flush();
out.close();
}
/**
* Initialization of the servlet. <br>
*
* @throws ServletException if an error occurs
*/
public void init() throws ServletException {
// Put your code here
}
}
- 新学的代码
- 新学的代码
- 新学的代码
- matlab新学的一些代码
- 新学的
- 新学的
- HelloWorld_dojo_新学的东东
- Emacs新学的快捷键
- 新学的知识
- 新学的知识
- 新学的知识
- 新学的几个函数
- 新学到的概念
- .xml的新学
- 新学的三子棋小游戏
- 新学
- 新学入侵常用的命令.
- 新学的java5新特性
- servlet
- cookie技术
- JSP
- JSP初级入门
- JSP 小小乘法表 嘿嘿
- 新学的代码
- JSP
- Java Servlet 编程及应用
- 数据库的学习感受
- XML语法
- sql server复习 Select 语句。
- 防范 SQL 注入,需要采用PreparedStatement取代Statement
- 使用Session完成用户登陆 利用Session实现验证码校验
- 学习“泛型”