简体   繁体   English

当param = xyz%时,request.getParameter(“ param”)不返回值

[英]request.getParameter(“param”) doesn't return value, when the param=xyz%

I'm passing one parameter param from jsp to servlet having a value like %xyz . 我正在将一个参数paramjsp传递到servlet ,其值类似于%xyz

When I'm trying to get the value in servlet by request.getParameter("param") I'm not getting any value. 当我尝试通过request.getParameter("param")获取servlet中的值时,我没有任何值。

Instead it is coming as blank (Not even Null). 相反,它以空白显示(甚至没有Null)。

Can, anyone please explain the reason. 可以,任何人请解释原因。

The % is a special character in uri. %是uri中的特殊字符。 You have to encode the % value using uri encoding. 您必须使用uri编码对%值进行编码。 In your case the % should be encoded as %25 在您的情况下, %应编码为%25

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM