zoukankan      html  css  js  c++  java
  • web继续

    11.28

    今天继续完善我的web系统,没有遇道什么问题,明天继续完善

    代码部分:

    package servlet;

    import java.io.IOException;
    import javax.servlet.ServletException;
    import javax.servlet.annotation.WebServlet;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;

    import dao.ChangeDao;

    /**
    * Servlet implementation class Change
    */
    @WebServlet("/Change")
    public class Change extends HttpServlet {
    private static final long serialVersionUID = 1L;

    /**
    * @see HttpServlet#HttpServlet()
    */
    public Change() {
    super();
    // TODO Auto-generated constructor stub
    }

    /**
    * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
    */
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    // TODO Auto-generated method stub
    String name = request.getParameter("name");
    String name1 = request.getParameter("name1");
    try{
    ChangeDao.changeTheName(name,name1);
    request.setAttribute("message", "修改成功");
    request.getRequestDispatcher("SelectServlet").forward(request,response);

    }catch(Exception e){
    System.out.println("保存失败");
    e.printStackTrace();
    }
    }

    /**
    * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
    */
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    // TODO Auto-generated method stub
    doGet(request, response);
    }

    }

    package servlet;

    import java.io.IOException;
    import javax.servlet.ServletException;
    import javax.servlet.annotation.WebServlet;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;

    import bean.TestBean;
    import dao.ChangeDao;

    /**
    * Servlet implementation class ChangeServlet
    */
    @WebServlet("/ChangeServlet")
    public class ChangeServlet extends HttpServlet {
    private static final long serialVersionUID = 1L;

    /**
    * @see HttpServlet#HttpServlet()
    */
    public ChangeServlet() {
    super();
    // TODO Auto-generated constructor stub
    }

    /**
    * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
    */
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    // TODO Auto-generated method stub
    String name = request.getParameter("name");
    TestBean test = ChangeDao.getByName(name);
    request.setAttribute("test", test);
    request.getRequestDispatcher("test/changename.jsp").forward(request,response);
    }

    /**
    * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
    */
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    // TODO Auto-generated method stub
    doGet(request, response);
    }

    }

    package servlet;

    import java.io.IOException;
    import javax.servlet.ServletException;
    import javax.servlet.annotation.WebServlet;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;

    import bean.TestBean;
    import dao.ChangeDao;

    /**
    * Servlet implementation class ChaServlet
    */
    @WebServlet("/ChaServlet")
    public class ChaServlet extends HttpServlet {
    private static final long serialVersionUID = 1L;

    /**
    * @see HttpServlet#HttpServlet()
    */
    public ChaServlet() {
    super();
    // TODO Auto-generated constructor stub
    }

    /**
    * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
    */
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    // TODO Auto-generated method stub
    String name = request.getParameter("name");
    TestBean test = ChangeDao.getByName(name);
    request.setAttribute("test", test);
    request.getRequestDispatcher("test/chathename.jsp").forward(request,response);
    }

    /**
    * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
    */
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    // TODO Auto-generated method stub
    doGet(request, response);
    }

    }

  • 相关阅读:
    excel导出的时候从程序后台写到excel里的是文本,所以无法在excel中计算怎么办?
    深度经验总结:快逸报表工具单数据集版本和多数据集版本的主要区别之一
    如何循序渐进有效学习 JavaScript?
    MariaDB和mySQL到底区别在哪,实验说明问题!
    实现点击页面报表头某个字段进行该字段的重新排序: 经过验证,此代码是工作的
    Oracle TDE的学习
    LOB类型的学习、总结
    使用GC 初始化DG(将备份集复制到目标端再初始化)
    oradebug 的学习 一
    角色 RESOURCE、CONNECT、DBA具有的权限
  • 原文地址:https://www.cnblogs.com/092e/p/14170131.html
Copyright © 2011-2022 走看看