社区
Web 开发
帖子详情
用request.getParameter("")得到的参数为什么是空的?
yinliangzhi
2004-09-10 04:22:04
我在一个网页中,用到另外一个网页的值,我使用request.getParameter("aa"),为什么得到的全是空值?
...全文
336
12
打赏
收藏
用request.getParameter("")得到的参数为什么是空的?
我在一个网页中,用到另外一个网页的值,我使用request.getParameter("aa"),为什么得到的全是空值?
复制链接
扫一扫
分享
转发到动态
举报
AI
作业
写回复
配置赞助广告
用AI写文章
12 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
Ronanljy
2004-09-11
打赏
举报
回复
初学者容易犯的错误。
dafei0320
2004-09-11
打赏
举报
回复
呵呵!form里就一个提交啊?
值都没有?
快放进去吧!
tangbow
2004-09-10
打赏
举报
回复
将文本狂放到 form表单里 就好了
yinliangzhi
2004-09-10
打赏
举报
回复
我太粗心了!打自己一个耳光!
phptong
2004-09-10
打赏
举报
回复
晕,你没把text这个表单元素没有在form表单里,传给另个页面当然是null值了,做事要仔细
yinliangzhi
2004-09-10
打赏
举报
回复
ding
yinliangzhi
2004-09-10
打赏
举报
回复
第一个页面:
<%@ page contentType="text/html;charset=GBK" %>
<%@ page language="java" import="java.sql.*" %>
<!-- !!!<%@ page import="ConnOracle" %> -->
<jsp:useBean id="connDb" scope="page" class="ConnOracle"/>
<html>
<head>
<title>无标题文档</title>
</head>
<body>
<!--<form name="form1" method="post" action="">-->
<table width="50%" border="0" align="center">
<tr>
<td align="center"><font size="+3">用户维护</font></td>
</tr>
</table>
<hr>
<table width="93%" border="1" align="center">
<tr>
<th scope="col">
</th>
<th scope="col">
</th>
<th scope="col">
</th>
<th scope="col"> </th>
</tr>
<tr bgcolor="#ccccff">
<td width="30%">
<div align="center"> <font color="#ff0033" size="3" > <b> 用户名</b></font> </div>
</td>
<td width="23%">
<div align="center"> <font color="#ff0033"> <b> 权限</b></font> </div>
</td>
<td width="26%">
<div align="center"> <font color="#ff0033"> <b> 备注</b></font> </div>
</td>
<td width="21%"> </td>
</tr>
<%
// out.println(session.getAttribute("quanxian_xuanze"));
ResultSet RS_result=null;
RS_result=connDb.executeQuery("select * from qx");
//String quanxian="";
%>
<% while(RS_result.next())
{
//out.println(java.util.Date())
%>
<tr>
<td width="30%"> <div align="center"> <font color="#ff0033"> <b><%= RS_result.getString(1) %> </b></font> </div> </td>
<td width="23%"> <div align="center"> <font color="#ff0033"> <b><%= RS_result.getString(2) %> </b></font> </div> </td>
<td width="26%">
<div align="center"> <font color="#ff0033"> <b><%= RS_result.getString(3) %> </b></font> </div>
</td>
<td width="21%" align="center"><input type="submit" name="Submit" value=" 修 改 ">
<input type="submit" name="Submit" value=" 删 除 ">
</td>
</tr>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
<%
}
RS_result.close();
%>
</table>
<hr>
<table width="93%" border="0" align="center">
<tr bgcolor="#ccccff">
<td align="left" bgcolor="#ccccff"><font size="4">添加项目</font></td>
</tr>
</table>
<table width="93%" border="0" align="center">
<tr>
<td width="31%" align="left"><font color="#ff0033"><b>用户
<input name="textyonghu" type="text">
</b></font></td>
<td width="15%" align="left"><font color="#ff0033"><b>权限</b></font>
<font color="#ff0033"><b>
<select name="selectquanxian" >
<option value="A">A</option>
<option selected>B</option>
<option>C</option>
<option>D</option>
</select>
</b></font></td>
<td width="31%" align="left"><font color="#ff0033"><b>备注
<input name="textbeizhu" type="text">
</b></font></td>
<td width="23%" align="center">
<form action="tianjia.jsp" method="post" >
<input type="submit" name="Submit" value=" 添加" >
</form>
</td>
</tr>
</table>
<!--</form>-->
</body>
</html>
第二个页面:
<%@ page contentType="text/html;charset=GBK" %>
<%@ page language="java" import="java.sql.*" %>
<!-- !!!<%@ page import="ConnOracle" %> -->
<jsp:useBean id="connDb" scope="page" class="ConnOracle"/>
<%
String tianjia_yonghuming=request.getParameter("textyonghu");
String tianjia_quanxian="C";
session.setAttribute("quanxian_xuanze","xx");//request.getParameter("select_quanxian"));
String tianjia_beizhu=request.getParameter("textbeizhu");
if (tianjia_yonghuming ==null){
tianjia_yonghuming="aa";
}
//if (tianjia_yonghuming != null && tianjia_yonghuming.length()>0){
//ResultSet RS_result=null;
//RS_result=connDb.executeQuery("select * from qx");
String sql ="insert into qx values"+"("+"'"+tianjia_yonghuming+"','"+tianjia_quanxian+"','"+tianjia_beizhu+"' "+")";
// String sql ="insert into qx values('xx','B','ff')";
connDb.executeUpdate(sql);
//}
%>
<jsp:forward page="qx.jsp"/>
wizardnjau
2004-09-10
打赏
举报
回复
这种情况既然已经知道是null的话就可以找找原因了嘛,无非就是两个页面,要是帖出代码就很快能够解决
weepp
2004-09-10
打赏
举报
回复
就是吗?!
flyxxxxx
2004-09-10
打赏
举报
回复
表单中如果有<input type="file">那用这种方法得到的一定是null(要使用smartupload)
tangbow
2004-09-10
打赏
举报
回复
94
贴出前面一个代码
phptong
2004-09-10
打赏
举报
回复
把前一个页面的代码贴出来看看,就是要传值出来的页面
Servlet 获得
参数
Servlet 获得
参数
EL表达式使用文档,方便快速使用EL表达式.pdf
EL表达式使用文档,方便快速使用EL表达式
url中文乱码处理大全.docx
url中文乱码处理大全.docx
解决中文乱码问题-java
解决中文乱码问题 解决中文乱码问题 解决中文乱码问题
柱状图-ext
柱状图-ext
Web 开发
81,122
社区成员
341,744
社区内容
发帖
与我相关
我的任务
Web 开发
Java Web 开发
复制链接
扫一扫
分享
社区描述
Java Web 开发
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章