无法从JSP页面检索参数值

时间:2012-12-20 10:42:00

标签: java javascript

假设

home.jsp 代码包含类似

的按钮
<input name="R" onclick="del(<%=rs.getString("VDB")%>)" type="radio" value="<%=rs.getString("VDB")%>" />

// note :我在del()

中传递了VDB的值

它将javascript称为:

<script type="text/javascript">
function del(delno)
{
 var ff = document.vendorform;

 var url = "delete.jsp?+vendor="+delno;
 window.navigate("delete_vendor.jsp?+vendor="+delno);

 //window.location.href="delete_vendor.jsp?+vendor="+delno;
 //ff.method = "POST";
 //ff.action ="delete_vendor.jsp?+vendor="+delno;
 //ff.submit();
}//i have used 3 methods to redirect to delete.jsp


delete.jsp:
在这个页面上我想检索我使用的供应商的值:

String D1=request.getParameter("vendor");

但是获得空值。
任何帮助

2 个答案:

答案 0 :(得分:1)

var url = "delete.jsp?+vendor="+delno;

您插入了错误的字符串+vendor。它应该只是网址中的vendor

var url = "delete.jsp?vendor="+delno;

答案 1 :(得分:1)

删除word供应商之前的“+”。变化

var url = "delete.jsp?+vendor="+delno;

var url = "delete.jsp?vendor="+delno;