关于post方法和get方法?请大家帮忙?

firefree 2003-10-17 04:13:46
下面两个文件,在执行的时候test.jsp页面全显示null null null null null null null null null null null null null null null null null null null null null null null null ,但如果把tsjj_insert.jsp页面from的post方法改为get方法,问题就可以解决,这是为什么?post方法和get方法有什么区别?如果我要用post方法怎么办?
代码如下:

tsjj_insert如下:
<%@ page contentType="text/html;charset=gb2312"%>
<%@ page import="java.sql.*"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>投诉检举</title>
</head>
<body>

<% Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

//类型声明
String unl="jdbc:odbc:piccserver";//连接字串
String sqlstr;//查询内容字串
ResultSet rs;//查询结果集

//连接数据库
Connection con=DriverManager.getConnection(unl);
Statement stmt=con.createStatement();
%>

<form action="test.jsp" method="post" enctype="multipart/form-data">
<table cellSpacing=0 cellPadding=0 width=750 border=1 >
<tr>
<td width="250" height="18">投诉登记号:</td>
<td width="250">投诉时间:</td>
<td width=250>经办人: </td>
</tr>
</table>
<table cellSpacing=0 cellPadding=0 width=750 border=1>
<tr>
<td width="746" height="15"><font color="#FF0000">投诉信息:</font></td>
</tr>
</table>
<table cellSpacing=0 cellPadding=0 width=750 border=1>
<tr>
<td width="245" height="23">
<div align="right">被投诉部门:
<select name="set_BTSBM" dir="ltr" style="WIDTH: 140px">
<% sqlstr="SELECT * FROM BRANCHINFO ";//被投诉部门
rs=stmt.executeQuery(sqlstr);
while (rs.next()) { %>
<option value="0"><%=rs.getString("CORPNAME")%></option>
<%}%>
</select>
</div></td>
<td width="249"><div align="right">被投诉人:
<input type="text" name="txt_BTSR" >
</div></td>
<td width="248"><div align="right">投诉类型:
<select name="set_TSLX" dir="ltr" style="WIDTH: 140px">
<% sqlstr="SELECT * FROM TSCLASSDATA";//投诉类型
rs=stmt.executeQuery(sqlstr);
while (rs.next()) { %>
<option value="0"><%=rs.getString("NAME")%></option>
<%}%>
</select>
</div></td>
</tr>
</table>
<table cellSpacing=0 cellPadding=0 width=750 border=1>
<tr>
<td><font color="#FF0000">投诉人信息:</font></td>
</tr>
</table>
<table cellSpacing=0 cellPadding=0 width=750 border=1>
<tr>
<td width=250 height="20">
<div align="right">
<label>
<input type="radio" name="rao_client" value="0" checked=true>
保户</label>
<label>
<input type="radio" name="rao_client" value="1">
其他客户</label>
</div></td>
<td width=250><div align="right">联系地址:
<input type="text" name="txt_LXDZ">
</div></td>
<td width="250"><div align="right">邮政编码:
<input type="text" name="txt_postcode">
</div></td>
</tr>
</table>
<table cellSpacing=0 cellPadding=0 width=750 border=1>
<tr>
<td height="18" width="245"> <div align="right">投诉人:
<input type="text" name="txt_TSR">
</div></td>
<td width="249"><div align="right">联系电话:
<input type="text" name="txt_phone">
</div></td>
<td width="248"><p align="right">E_Mail:
<input type="text" name="txt_email"></td>
</tr>
</table>
<table cellSpacing=0 cellPadding=0 width=750 border=1>
<tr>
<td width="245">保存类型: </td>
<td width="500">投诉环节:</td>
</tr>
</table>
<table cellSpacing=0 cellPadding=0 width=750 border=1>
<tr>
<td width=82> <div align="right">
<input type="radio" name="rao_save" checked value="0">
投 诉 </div></td>
<td width="241"><div align="right">投保险类:
<select name="set_TBXL" style="WIDTH: 150px">
<% sqlstr="Select * From XLINFO order by xlid";//投保险类
rs=stmt.executeQuery(sqlstr);
while (rs.next()) { %>
<option value="0"><%=rs.getString("XLNAME")%></option>
<%}%>
</select>
</div></td>
<td width="222"><div align="right">保单号:
<input type="text" name="txt_BDH" width="150">
</div></td>
<td width="203"><div align="right">
<input type="radio" name="rao_action" value="11" checked>
投保
<input type="radio" name="rao_action" value="12">
理赔
<input type="radio" name="rao_action" value="13">
其他</div></td>
</tr>
<tr>
<td> <div align="right">
<input type="radio" name="rao_save" value="1">
检 举 </div></td>
<td width="241"><div align="right">标的名称:
<input type="text" name="txt_BDMC" width="150">
</div></td>
<td width="222"><div align="right">赔案号:
<input type="text" name="txt_PAH" width="150">
</div></td>
<td width="203"><div align="right">其他:
<input type="text" name="txt_other" width="150">
</div></td>
</tr>
</table>
<table cellSpacing=0 cellPadding=0 width=750 border=1>
<tr>
<td width=375 height="20"> <p>投诉内容: </p></td>
<td width=375>客户要求:</td>
</tr>
<tr>
<td height="50"><textarea rows=6 cols=50 wrap=soft name="tea_TSNR" ></textarea></td>
<td><textarea rows=6 cols=50 wrap=soft name="tea_KHYQ" ></textarea></td>
</tr>
</table>
<table cellSpacing=0 cellPadding=0 width=750 border=1>
<tr>
<td height="20"> <p>95518主管意见: </p></td>
<td>客户中心主任意见:</td>
</tr>
<tr>
<td height="50"><textarea rows=6 cols=50 wrap=soft name="tea_ZGYJ" ></textarea></td>
<td><textarea rows=6 cols=50 wrap=soft name="tea_ZRYJ" ></textarea></td>
</tr>
</table>
<table cellSpacing=0 cellPadding=0 width=750 border=1>
<tr>
<td height="20" width="236">转交单位:
<select name="set_ZJDW" style="WIDTH: 137px">
<% sqlstr="SELECT * FROM DEPTINFO ";//转交单位
rs=stmt.executeQuery(sqlstr);
while (rs.next()) { %>
<option value="0"><%=rs.getString("DEPTNAME")%></option>
<%}%>
</select></td>
<td>转交时间:
<input type="text" name="txt_ZJSJ"></td>
<td width="257">反馈结果:</td>
</tr>
<tr>
<td height="25">答复人:
<input type="text" name="txt_DFR" width="150"></td>
<td>反馈时间: <input type="text" name="txt_FKSJ"></td>
<td width="257" rowspan="2"> <textarea rows=3 cols=34 name="tea_FKJG"></textarea></td>
</tr>
<tr>
<td width="236" height="20">是否及时催办:
<input type="checkbox" name="chx_JSCB" value="1">
是 </td>
<td width="249">答复时间: <input type="text" name="txt_DFSJ"></td>
</tr>
</table>
<table cellSpacing=0 cellPadding=0 width=750 border=1>
<tr>
<td height="23">
<div align="center">
<input type="button" name="Submit" value="添加">
</div></td>
<td><div align="center">
<input type="button" name="Submit2" value="查询">
</div></td>
<td><div align="center">
<input type="submit" name="Submit3" value="保存">
</div></td>
<td><div align="center">
<input type="reset" name="Submit4" value="清空">
</div></td>
</tr>
</table>
</div>
</form>
</body>
</html>
...全文
58 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
firefree 2003-10-20
  • 打赏
  • 举报
回复
在网上看了一些,但不大明白,有谁知道就请告诉我为什么把enctype="multipart/form-data"去掉就可以了?
djws 2003-10-17
  • 打赏
  • 举报
回复
网上搜一下,有很多教你如何使用支持文件上传的第三方类jspsmartupload的帮助文档,教程之类的,绝大多数教程在提及原理的时候会对enctype="multipart/form-data"做详细的说明,自己看看吧
firefree 2003-10-17
  • 打赏
  • 举报
回复
请告诉我为什么会这样好吗?为什么把enctype="multipart/form-data"去掉就可以了?它是做什么用的?
aku0708 2003-10-17
  • 打赏
  • 举报
回复
把它改成下面这样,试试:
<%@ page contentType="text/html;charset=gb2312"%>
<%@ page import="java.sql.*"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>投诉检举</title>
</head>
<body>

<% Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");

//类型声明
String unl="jdbc:odbc:piccserver";//连接字串
String sqlstr;//查询内容字串
ResultSet rs;//查询结果集

//连接数据库
Connection con=DriverManager.getConnection(unl);
Statement stmt=con.createStatement();
%>

<form action="test.jsp" method="post" >
<table cellSpacing=0 cellPadding=0 width=750 border=1 >
<tr>
<td width="250" height="18">投诉登记号:</td>
<td width="250">投诉时间:</td>
<td width=250>经办人: </td>
</tr>
</table>
<table cellSpacing=0 cellPadding=0 width=750 border=1>
<tr>
<td width="746" height="15"><font color="#FF0000">投诉信息:</font></td>
</tr>
</table>
<table cellSpacing=0 cellPadding=0 width=750 border=1>
<tr>
<td width="245" height="23">
<div align="right">被投诉部门:
<select name="set_BTSBM" dir="ltr" style="WIDTH: 140px">
<% sqlstr="SELECT * FROM BRANCHINFO ";//被投诉部门
rs=stmt.executeQuery(sqlstr);
while (rs.next()) { %>
<option value="0"><%=rs.getString("CORPNAME")%></option>
<%}%>
</select>
</div></td>
<td width="249"><div align="right">被投诉人:
<input type="text" name="txt_BTSR" >
</div></td>
<td width="248"><div align="right">投诉类型:
<select name="set_TSLX" dir="ltr" style="WIDTH: 140px">
<% sqlstr="SELECT * FROM TSCLASSDATA";//投诉类型
rs=stmt.executeQuery(sqlstr);
while (rs.next()) { %>
<option value="0"><%=rs.getString("NAME")%></option>
<%}%>
</select>
</div></td>
</tr>
</table>
<table cellSpacing=0 cellPadding=0 width=750 border=1>
<tr>
<td><font color="#FF0000">投诉人信息:</font></td>
</tr>
</table>
<table cellSpacing=0 cellPadding=0 width=750 border=1>
<tr>
<td width=250 height="20">
<div align="right">
<label>
<input type="radio" name="rao_client" value="0" checked=true>
保户</label>
<label>
<input type="radio" name="rao_client" value="1">
其他客户</label>
</div></td>
<td width=250><div align="right">联系地址:
<input type="text" name="txt_LXDZ">
</div></td>
<td width="250"><div align="right">邮政编码:
<input type="text" name="txt_postcode">
</div></td>
</tr>
</table>
<table cellSpacing=0 cellPadding=0 width=750 border=1>
<tr>
<td height="18" width="245"> <div align="right">投诉人:
<input type="text" name="txt_TSR">
</div></td>
<td width="249"><div align="right">联系电话:
<input type="text" name="txt_phone">
</div></td>
<td width="248"><p align="right">E_Mail:
<input type="text" name="txt_email"></td>
</tr>
</table>
<table cellSpacing=0 cellPadding=0 width=750 border=1>
<tr>
<td width="245">保存类型: </td>
<td width="500">投诉环节:</td>
</tr>
</table>
<table cellSpacing=0 cellPadding=0 width=750 border=1>
<tr>
<td width=82> <div align="right">
<input type="radio" name="rao_save" checked value="0">
投 诉 </div></td>
<td width="241"><div align="right">投保险类:
<select name="set_TBXL" style="WIDTH: 150px">
<% sqlstr="Select * From XLINFO order by xlid";//投保险类
rs=stmt.executeQuery(sqlstr);
while (rs.next()) { %>
<option value="0"><%=rs.getString("XLNAME")%></option>
<%}%>
</select>
</div></td>
<td width="222"><div align="right">保单号:
<input type="text" name="txt_BDH" width="150">
</div></td>
<td width="203"><div align="right">
<input type="radio" name="rao_action" value="11" checked>
投保
<input type="radio" name="rao_action" value="12">
理赔
<input type="radio" name="rao_action" value="13">
其他</div></td>
</tr>
<tr>
<td> <div align="right">
<input type="radio" name="rao_save" value="1">
检 举 </div></td>
<td width="241"><div align="right">标的名称:
<input type="text" name="txt_BDMC" width="150">
</div></td>
<td width="222"><div align="right">赔案号:
<input type="text" name="txt_PAH" width="150">
</div></td>
<td width="203"><div align="right">其他:
<input type="text" name="txt_other" width="150">
</div></td>
</tr>
</table>
<table cellSpacing=0 cellPadding=0 width=750 border=1>
<tr>
<td width=375 height="20"> <p>投诉内容: </p></td>
<td width=375>客户要求:</td>
</tr>
<tr>
<td height="50"><textarea rows=6 cols=50 wrap=soft name="tea_TSNR" ></textarea></td>
<td><textarea rows=6 cols=50 wrap=soft name="tea_KHYQ" ></textarea></td>
</tr>
</table>
<table cellSpacing=0 cellPadding=0 width=750 border=1>
<tr>
<td height="20"> <p>95518主管意见: </p></td>
<td>客户中心主任意见:</td>
</tr>
<tr>
<td height="50"><textarea rows=6 cols=50 wrap=soft name="tea_ZGYJ" ></textarea></td>
<td><textarea rows=6 cols=50 wrap=soft name="tea_ZRYJ" ></textarea></td>
</tr>
</table>
<table cellSpacing=0 cellPadding=0 width=750 border=1>
<tr>
<td height="20" width="236">转交单位:
<select name="set_ZJDW" style="WIDTH: 137px">
<% sqlstr="SELECT * FROM DEPTINFO ";//转交单位
rs=stmt.executeQuery(sqlstr);
while (rs.next()) { %>
<option value="0"><%=rs.getString("DEPTNAME")%></option>
<%}%>
</select></td>
<td>转交时间:
<input type="text" name="txt_ZJSJ"></td>
<td width="257">反馈结果:</td>
</tr>
<tr>
<td height="25">答复人:
<input type="text" name="txt_DFR" width="150"></td>
<td>反馈时间: <input type="text" name="txt_FKSJ"></td>
<td width="257" rowspan="2"> <textarea rows=3 cols=34 name="tea_FKJG"></textarea></td>
</tr>
<tr>
<td width="236" height="20">是否及时催办:
<input type="checkbox" name="chx_JSCB" value="1">
是 </td>
<td width="249">答复时间: <input type="text" name="txt_DFSJ"></td>
</tr>
</table>
<table cellSpacing=0 cellPadding=0 width=750 border=1>
<tr>
<td height="23">
<div align="center">
<input type="button" name="Submit" value="添加">
</div></td>
<td><div align="center">
<input type="button" name="Submit2" value="查询">
</div></td>
<td><div align="center">
<input type="submit" name="Submit3" value="保存">
</div></td>
<td><div align="center">
<input type="reset" name="Submit4" value="清空">
</div></td>
</tr>
</table>
</div>
</form>
</body>
</html>
firefree 2003-10-17
  • 打赏
  • 举报
回复
test文件如下:
<%@ page import="java.sql.*" %>
<%
//告诉编译器使用SQL包
%>
<%
out.println(request.getParameter("txt_TSR"));
out.println(request.getParameter("txt_phone"));
out.println(request.getParameter("txt_email"));
out.println(request.getParameter("set_BTSBM"));
out.println(request.getParameter("txt_BTSR"));
out.println(request.getParameter("set_TSLX"));
out.println(request.getParameter("set_ZJDW"));
out.println(request.getParameter("tea_TSNR"));
out.println(request.getParameter("经办人"));
out.println(request.getParameter("tea_ZGYJ"));
out.println(request.getParameter("txt_BDH"));
out.println(request.getParameter("txt_LXDZ"));
out.println(request.getParameter("txt_postcode"));
out.println(request.getParameter("TmpXLID"));
out.println(request.getParameter("txt_DFR"));
out.println(request.getParameter("tea_KHYQ"));
out.println(request.getParameter("txt_BDMC"));
out.println(request.getParameter("txt_PAH"));
out.println(request.getParameter("txt_other"));
out.println(request.getParameter("tea_ZRYJ"));
out.println(request.getParameter("txt_ZJSJ"));
out.println(request.getParameter("txt_FKSJ"));
out.println(request.getParameter("txt_DFSJ"));
out.println(request.getParameter("tea_FKJG"));
%>

81,091

社区成员

发帖
与我相关
我的任务
社区描述
Java Web 开发
社区管理员
  • Web 开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧