用request.getParameter("")得不到值

lifei515 2011-12-21 10:20:04
document.getElementById('fm').action="<%=basePath%>/mobilenetinterface?mobile_net_type=runPage&jtq=onlyrecord&urlKey=" + i + "&ProjectID=3&IsModel=false&jtr=" + jtr + "&jtrr=";
document.getElementById('fm').submit();

servlet用这种提交,用request.getParameter("mobile_net_type")后台获取不到值,为null
请各位指教
...全文
143 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
lifei515 2011-12-21
  • 打赏
  • 举报
回复
这个是我的jsp代码
lifei515 2011-12-21
  • 打赏
  • 举报
回复
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%
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>pdf内容页面</title>
<script type="text/javascript" src="js/JQuery.js"></script>
<script type="text/javascript">
function chinahrPram(a) {
var e = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";
a = escape(a);
var i = "", f, b, c = "", j, k, g, d = "", h = 0;
do {
f = a.charCodeAt(h++);
b = a.charCodeAt(h++);
c = a.charCodeAt(h++);
j = f >> 2;
k = (f & 3) << 4 | b >> 4;
g = (b & 15) << 2 | c >> 6;
d = c & 63;
if (isNaN(b)) {
g = d = 64;
} else {
if (isNaN(c)) {
d = 64;
}
}
i = i + e.charAt(j) + e.charAt(k) + e.charAt(g) + e.charAt(d);
f = b = c = "";
j = k = g = d = "";
} while (h < a.length);
var jtr = chinahrParamJtr();
document.getElementById('fm').action="<%=basePath%>/mobilenetinterface?mobile_net_type=runPage&jtq=onlyrecord&urlKey=" + i + "&ProjectID=3&IsModel=false&jtr=" + jtr + "&jtrr=";
document.getElementById('fm').submit();
}
function chinahrParamJtr() {
var b = "";
for(i=0;i<8;i++){
b += parseInt(Math.random()*10);
}
return b;
}
</script>
</head>

<body>
<form id="fm" name="fm" method="GET">
<table width="100%" cellspacing="1" cellpadding="0" border="0">
<thead class="pn-lthead">
<tr>
<th>
公司名称
</th>
<th>
操作
</th>
</tr>
</thead>
<tbody class="pn-ltbody">

<c:forEach items="${sessionScope.chinahrList}" var="chinahr">
<tr>
<td>
<a href="${chinahr.chinahrurl }" target="_blank"
title="${chinahr.chinahrname }">${chinahr.chinahrname }</a>
</td>
<td></td>
</tr>
</c:forEach>
</tbody>
</table>
<div class="pn-sp">
<div class="pn-sp-left">
共 ${requestScope.totalCount } 条  每页 ${requestScope.pageCount }

</div>
<div class="pn-sp-right">
<a href="javascript:void(0);"
onClick="chinahrPram('${sessionScope.chinahrParam}');">首页</a>
<a href="javascript:void(0);"
onClick="chinahrPram('${sessionScope.chinahrParam}');">上一页</a>
<a href="javascript:void(0);"
onClick="chinahrPram('${sessionScope.chinahrParam}');">下一页</a>
<a href="javascript:void(0);"
onClick="chinahrPram('${sessionScope.chinahrParam}');">尾页</a>    
当前第 ${requestScope.pages } 页 / 共 ${requestScope.totalPage } 页
<a href="<%=basePath%>/mobilenetinterface?mobile_net_type=XISExport">导出</a>
</div>
<div class="clear"></div>
</div>
</form>
</body>
</html>
lifei515 2011-12-21
  • 打赏
  • 举报
回复
两位的回答 我试了还是不行啊
wang7535067 2011-12-21
  • 打赏
  • 举报
回复
1楼正解,
  • 打赏
  • 举报
回复
注意表单提交的方式
post和get 对应servlet中的dopost和doget方法
如果方法一样,但涉及俩种提交方式,可以在另一个方法里直接调用dopost(doget)就行
sunnylyy 2011-12-21
  • 打赏
  • 举报
回复
form提交方式改成GET,就能取到了

50,530

社区成员

发帖
与我相关
我的任务
社区描述
Java相关技术讨论
javaspring bootspring cloud 技术论坛(原bbs)
社区管理员
  • Java相关社区
  • 小虚竹
  • 谙忆
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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