关于JSP使用GET方法传递参数的问题(100分)

fj20059 2003-03-14 01:42:39
求教了

我使用get方式传递参数形式如下:
test.jsp?cust_id=P239823#08

提交后,使用
cust_id = requet.getParameter("cust_id");方式获取参数值

但获得的参数值却是 P239823 ,#号和后面的数字没有传递过来,请交各位如何解决
有分相送
...全文
57 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
sasa_sasa 2003-03-14
  • 打赏
  • 举报
回复
test.jsp?cust_id=<%=java.net.URLEncoder.encode("P239823#08")%>


cust_id = java.net.URLDecoder.decode(requet.getParameter("cust_id"));

还是这样保险一点..
flashroom 2003-03-14
  • 打赏
  • 举报
回复
encode掉它。中文问题同样适用
lfxhyf7979 2003-03-14
  • 打赏
  • 举报
回复
3332221119(飘) 是最佳方案
但获取页面不用写
cust_id = java.net.URLDecoder.decode(requet.getParameter("cust_id"));
直接取即可:
String strCustId = requet.getParameter("cust_id");
cdk 2003-03-14
  • 打赏
  • 举报
回复
传参之前先把 # 转换成其他字符,

str.replaceAll("#","@");

接收后再转换回来!
str.replaceAll("@","#");
3332221119 2003-03-14
  • 打赏
  • 举报
回复

test.jsp?cust_id=<%=java.net.URLEncoder.encode("P239823#08")%>


cust_id = java.net.URLDecoder.decode(requet.getParameter("cust_id"));

81,092

社区成员

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

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