Value passed with request.setAttribute() is not available by request.getParameter()
Solution 1:
You're calling request.getParameter()
instead of request.getAttribute()
to obtain the value. Since you've set it as request attribute, you should also get it as request attribute.
So:
request.setAttribute("foo", foo);
is only available by
Object foo = request.getAttribute("foo"); // NOT getParameter().
The getParameter()
is only for HTTP request parameters as you can specify in request URL or in input fields of HTML forms.