jsp 用form表单输入数据后写入数据库
<%@pagelanguage="java"import="java.util.*,java.sql.*"pageEncoding="UTF-8"%><%Stringpa...
<%@ page language="java" import="java.util.*,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 'point_add.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"); %>
<center>
<form action="point/point_add_check.jsp" method="post">
<table border="1">
<tr>
<td>学期:</td>
<td>
<select name="term" id="term">
<option>第一学期</option>
<option>第二学期</option>
<option>第三学期</option>
<option>第四学期</option>
<option>第五学期</option>
<option>第六学期</option>
</select>
</td>
</tr>
<tr>
<td>班级:</td>
<td><input type="text" name="clss"></td>
<tr>
<td>科目:</td>
<td><input type="text" name="subject"></td>
</tr>
<tr>
<td>学生学号:</td>
<td><input type="text" id="a" name="number" onkeyup="value=value.replace(/[^(\d)]/g,'')"/></td>
</tr>
<tr>
<td>姓名:</td>
<td><input type="text" name="username"></td>
</tr>
<tr>
<td>分数:</td>
<td><input type="text" id="a" name="point" onkeyup="value=value.replace(/[^(\d)]/g,'')"/></td>
</tr>
</table>
<input type="submit"value="确定"/>
</form>
<input type=button value="返回" onclick="location.href = 'adminshowA.jsp'" />
</center>
</body>
</html>
上班是我form表单的代码 现在是采用跳转页面去写入数据库的 我想让他不跳转页面 直接在这个页面按确定后写入数据库有没有办法 展开
<%
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 'point_add.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"); %>
<center>
<form action="point/point_add_check.jsp" method="post">
<table border="1">
<tr>
<td>学期:</td>
<td>
<select name="term" id="term">
<option>第一学期</option>
<option>第二学期</option>
<option>第三学期</option>
<option>第四学期</option>
<option>第五学期</option>
<option>第六学期</option>
</select>
</td>
</tr>
<tr>
<td>班级:</td>
<td><input type="text" name="clss"></td>
<tr>
<td>科目:</td>
<td><input type="text" name="subject"></td>
</tr>
<tr>
<td>学生学号:</td>
<td><input type="text" id="a" name="number" onkeyup="value=value.replace(/[^(\d)]/g,'')"/></td>
</tr>
<tr>
<td>姓名:</td>
<td><input type="text" name="username"></td>
</tr>
<tr>
<td>分数:</td>
<td><input type="text" id="a" name="point" onkeyup="value=value.replace(/[^(\d)]/g,'')"/></td>
</tr>
</table>
<input type="submit"value="确定"/>
</form>
<input type=button value="返回" onclick="location.href = 'adminshowA.jsp'" />
</center>
</body>
</html>
上班是我form表单的代码 现在是采用跳转页面去写入数据库的 我想让他不跳转页面 直接在这个页面按确定后写入数据库有没有办法 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询