I have a http form which has two name/value pairs (SVCNAME and STRING) which call a servlet. I want to be able to remove the SVCNAME parameter and value from the request object in the servlet, so that only the STRING parameter remains. Any help gratefully appreciated.
use this method :
I tried the following and received an incompatible type error on compiling:
req = req.removeAttribute("SVCNAME");
tp_60000.java:115: incompatible types
found : void
req = req.removeAttribute(svcnm);
Now I'm a little confused....
If I do :
Enumeration params = req.getParameterNames();
I can step thru the parameters and their values.If I do req.getAttributeNames(), I don't see any elements. I can step thru the various parameters but can't see a method of removing a parameter/value pair. Are attributes associated with sessions/cookies?
The reason you get the error message is because the removeAttribute method does not return anything. Its return type is void but you were trying to put the return value in req.
So just call req.removeAttribute(abc)
instead of req = req.removeAttribute(abc)