当前位置 : 主页 > 编程语言 > java >

web继续走起

来源:互联网 收集:自由互联 发布时间:2022-06-23
11.23 今天继续写我的web系统,没遇到什么问题,系统模型已经有了,下面就是完善了,明天计划完善web系统。 代码部分: package com.pp; import java.io.IOException; import java.sql.SQLException;import

11.23

今天继续写我的web系统,没遇到什么问题,系统模型已经有了,下面就是完善了,明天计划完善web系统。

代码部分:

package com.pp;
import java.io.IOException;
import java.sql.SQLException;import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;/**
* Servlet implementation class shanchu
*/
@WebServlet("/shanchu")
public class shanchu extends HttpServlet {
private static final long serialVersionUID = 1L;

/**
* @see HttpServlet#HttpServlet()
*/
public shanchu() {
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 xingming=request.getParameter("xingming");
dao L=new dao();
try {
L.delete(xingming);
request.getRequestDispatcher("delete.jsp").forward(request, response);
} catch (SQLException e) {
// TODO Auto-generated catch block
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 com.pp;
import java.io.IOException;
import java.sql.SQLException;import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;/**
* Servlet implementation class People
*/
@WebServlet("/xuesheng")
public class xuesheng extends HttpServlet {
private static final long serialVersionUID = 1L;

/**
* @see HttpServlet#HttpServlet()
*/
public xuesheng() {
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 xuehao=request.getParameter("xuehao");
String xingming=request.getParameter("xingming");
String banji=request.getParameter("banji");
String kecheng=request.getParameter("kecheng");
String fenshu=request.getParameter("fenshu");

get login=new get(xuehao,xingming,banji,kecheng,fenshu);
dao L=new dao();
try {
L.insert(login);
request.getRequestDispatcher("xuesheng.jsp").forward(request, response);
} catch (SQLException e) {
// TODO Auto-generated catch block
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);
}}
上一篇:RadioButton点击一次一直再次点击不起作用
下一篇:没有了
网友评论