如何删除HttpServletRequest参数(在JSP中)? [英] How to remove HttpServletRequest parameters (in JSP)?
问题描述
如何取消设置或删除HttpServletRequest
参数(尤其是在JSP中)(例如在PHP中使用unset($_POST['index'])
函数)?我尝试了以下方法.
How can an HttpServletRequest
parameter (especially in JSP) be unset or removed (like in PHP using the unset($_POST['index'])
function)? I have tried the following.
Map requestMap=request.getParameterMap();
requestMap.remove("index");
但它说
不允许对锁定的ParameterMap进行修改
No modifications are allowed to a locked ParameterMap
是否可以取消设置请求参数?
Is there a way to unset request parameters?
推荐答案
是否可以取消设置请求参数?
Is there a way to unset request parameters?
AFAIK,不在JSP本身(或与此相关的任何Servlet)之内.
AFAIK, not within the JSP itself (or any Servlet for that matter).
但是您可以编写一个Filter,以替换参数映射的方式包装当前的Request.
But you could write a Filter that wrapped the current Request in a way that replaces the parameter map.
这篇关于如何删除HttpServletRequest参数(在JSP中)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!