addteacher_confirm.jsp

来自「学生/教师信息管理系统,用JSP+ACCESS开发」· JSP 代码 · 共 34 行

JSP
34
字号
<%@ page contentType="text/html; charset=gb2312" language="java" import="java.sql.*" errorPage="errorpage.jsp" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<jsp:useBean id="sqlB" scope="request" class="stu.sqlBean"/>
<body bgcolor="#4692B3" text="#FFFFFF" link="#00FF00">
<div align="center">
  <%
String admin_id = (String)session.getAttribute("id"); 
if(admin_id==null){response.sendRedirect("login.jsp");}
try{
String id=request.getParameter("id");
String name=new String (request.getParameter("name").getBytes("iso8859_1"),"gbk");
String password=request.getParameter("password");
String title=new String (request.getParameter("title").getBytes("iso8859_1"),"gbk");
if(name==null || name.equals("")) throw new Exception ("错误,教师姓名不可为空!!");
if(id==null || id.equals("")) throw new Exception ("错误,教师号不可为空!!");
if(password==null || password.equals("")) throw new Exception ("错误,密码不可为空!!");
out.print("新增成功!"+"<br>");
out.print("教师姓名: "+name+"<br>");
out.print("教师ID:    "+id+"<br>");
out.print("职称    :"+title+"<br>");
String sql="insert into teacher(id,name,title,password)  "+ "values('"+id+"','"+name+"','"+title+"','"+password+"') ";
sqlB.executeInsert(sql);    
}catch(Exception e){
out.print(e.toString());
}
%>
</div>
<p>&nbsp;</p>
<p><a href="addteacher.jsp">&lt;&lt;Back</a></p>
</body>
</html>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?