首页

jsp入门级示例:学生信息管理系统(含数据库脚本)

java

2020-6-28

<%@ page language="java" import="java.util.*,com.db.*,java.sql.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme() "://" request.getServerName() ":" request.getServerPort() path "/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'AddStudentData.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

  </head>
  
  <body>
    <%
      request.setCharacterEncoding("UTF-8");
      String studentNumber=request.getParameter("studentNumber");
      String studentName=request.getParameter("studentName");
      String studentSex=request.getParameter("studentSex");
      int studentAge=Integer.parseInt(request.getParameter("studentAge"));
      int studentWeight=Integer.parseInt(request.getParameter("studentWeight"));
      
      Connection conn=null;
      PreparedStatement ps=null;
      try{
      conn=DBConnection.getConn();
      ps=conn.prepareStatement("insert into Student values(?,?,?,?,?)");
      ps.setString(1,studentNumber);
      ps.setString(2,studentName);
      ps.setString(3,studentSex);
      ps.setInt(4,studentAge);
      ps.setInt(5,studentWeight);
      int i=ps.executeUpdate();
      if(i>0)
        response.sendRedirect("StuAdmin.jsp");
      }catch(Exception e){
      e.printStackTrace();
      }finally{
        DBConnection.close(null,ps,conn);
      }
     %>
  </body>
</html>
资源下载此资源下载价格为3D币(VIP免费),请先
资源文件列表
student  成功/sqljdbc4-4.0.jar , 584207
student 成功/SQLQuery1.sql , 292
student 成功/studentSystem/.classpath , 621
student 成功/studentSystem/.mymetadata , 312
student 成功/studentSystem/.project , 1756
student 成功/studentSystem/.settings/.jsdtscope , 500
student 成功/studentSystem/.settings/com.genuitec.eclipse.j2eedt.core.xml , 99
student 成功/studentSystem/.settings/org.eclipse.jdt.core.prefs , 364
student 成功/studentSystem/.settings/org.eclipse.wst.common.component , 477
student 成功/studentSystem/.settings/org.eclipse.wst.common.project.facet.core.xml , 126
student 成功/studentSystem/.settings/org.eclipse.wst.jsdt.ui.superType.container , 49
student 成功/studentSystem/.settings/org.eclipse.wst.jsdt.ui.superType.name , 6
student 成功/studentSystem/src/com/db/DBConnection.java , 938
student 成功/studentSystem/src/com/db/Student.java , 1020
student 成功/studentSystem/WebRoot/AddStudent.jsp , 1838
student 成功/studentSystem/WebRoot/AddStudentData.jsp , 1837
student 成功/studentSystem/WebRoot/DeleteStudent.jsp , 1189
student 成功/studentSystem/WebRoot/DeletetidentDdata.jsp , 1405
student 成功/studentSystem/WebRoot/image/top.jpg , 49248
student 成功/studentSystem/WebRoot/LookUpdateStudent.jsp , 3273
student 成功/studentSystem/WebRoot/META-INF/MANIFEST.MF , 36
student 成功/studentSystem/WebRoot/SelectStudent.jsp , 2330
student 成功/studentSystem/WebRoot/StuAdmin.jsp , 1390
student 成功/studentSystem/WebRoot/UpdateStudent.jsp , 1134
student 成功/studentSystem/WebRoot/UpdateStudentData.jsp , 1980
student 成功/studentSystem/WebRoot/WEB-INF/classes/com/db/DBConnection.class , 1660
student 成功/studentSystem/WebRoot/WEB-INF/classes/com/db/Student.class , 1542
student 成功/studentSystem/WebRoot/WEB-INF/image/top.jpg , 49248
student 成功/studentSystem/WebRoot/WEB-INF/web.xml , 404
student 成功/top.jpg , 49248
没有账号? 忘记密码?

社交账号快速登录