I have long been successful communicating information from servlets to JSPs. I usually setup a dataBean object and then request.setAttribute ("dataBean",beanObject); Then in the JSP, i simply getAttribute ("dataBean") and cast the returned object to the bean's type and gain access to the dataBean's contents. Recently, I attempted the same operation but in reverse. I setAttribute ("parmName",parmValue); in a JSP scriptlet (Java is the scripting language), and then attempted a getAttribute ("parmName") in the servlet. The resulting object is always null. I am able to do a request.getAttribute ("parmName") in the JSP and have verified that the attribute is indeed being set in the request successfully by the JSP. Why cannot I access the attribute from the request in the servlet?
My guess is that the request ends shortly before the JSP is displayed, which is the response. It you click on the JSP again, that's the next (and therefore a separate) request. Since the object has only a single request scope, you don't get it in the next request to the servlet. (HTTP)session scope is different, of course, but then you have to take care of eliminating the object(s) from the HttpSession before it gets bloated with unneeded objects. Let's see what others say...
Tony Alicea Senior Java Web Application Developer, SCPJ2, SCWCD