<body bgcolor="#0099FF">
<%Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); //载入驱动程序类别
String url = "jdbc:odbc:studentdata";
String user="";String pwd="";
Connection con = DriverManager.getConnection(url,user, pwd); //建立数据库链接,studentdata为ODBC数据源名称
//建立Statement对象
Statement stmt = con.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_READ_ONLY);
String id=request.getParameter("id");
String name=request.getParameter("name");
String sex=request.getParameter("sex");
String age=request.getParameter("age");
String weight=request.getParameter("weight");
stmt.executeUpdate("insert into stu_info(id,name,sex,age,weight)values("+ id +",'"+ name +"','"+ sex +"',"+ age +",'"+ weight +"')");%>
<center><h2 class="style1">添加学生信息</h2>
<p class="style2"><br>新的数据已经添加到数据库中! </p>
<form name="form1" method="post" action="add.jsp">
<input type="submit" id="back" name="back" value="返回">
</form><p> </p></center></body></html>
Adduser.jsp: <%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<html>
<style type="text/css"><!--.style1 {color: #FF0000;font-size: 24px;}</style>
<body bgcolor="#0099FF"><div align="center" class="style1"><p>添加用户信息</p>
<form name="form1" method="post" action="add_1user.jsp">
</p><p><span class="style3">姓名:</span>
<input type="text" name="name"></p><p><span class="style3">密码:</span>
<input type="text" name="password"></p><p>
<input type="submit" name="queding" value="提交">
<input type="reset" name="chongtian" value="重置"></p><p> </p>
</form><p> </p></div></body></html>
Add_1user.jsp: <%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="" %>
<html>
<body bgcolor="#0099FF">
<center> <h2>添加用户信息</h2>
<hr><p>姓名:<%=request.getParameter("name")%></p>
<p>性别:<%=request.getParameter("password")%></p>
<form name="form1" method="post" action="add_2user.jsp">
<p><input type="hidden" id="name" name="name" value="<%=request.getParameter("name")%>">
<input type="hidden" id="password" name="password" value="<%=request.getParameter("password")%>"> </p>
<p><input type="submit" id="submit"name="queding" value="确定">
<input type="button" id="back"name="back" value="返回" onClick="java script:history.go(-1)"></p></form><p> </p>
</center></body><
首页 上一页 3 4 5 6 7 8 9 下一页 尾页 6/11/11
基于jsp实现-图书馆信息管理系统.(六)由毕业论文网(www.huoyuandh.com)会员上传。