Bear Bibeault wrote:If you put something away in the hall closet, would you go look for it later in the pantry?
Similarly, if you put a scoped variable into application scope, you will not later find it in request scope where you did not put it.
Yes, look for an item in the same closet that you put it in.
Faisal A. Khan wrote:Any bright idea . . . ?
Bauke Scholtz wrote:You're missing the fact that you shouldn't be using scriptlets for this.
Bear Bibeault wrote:You are placing the bean in request scope during the execution of the JSP. When the JSP finishes executing, the response is sent to the browser and the request is dismissed. So are any scoped variables in request context. So when the page is submitted, the bean has long since been gone and cannot be retrieved from the servlet. This is basic HTTP.
The fact that you are trying to send a bean from a JSP to a servlet indicates a few problems. First, that you do not yet understand how JSP and HTTP requests work, and second, probably indicates a design flaw of some sort.
For the former issue, please read this article. Then you may in a position to determine where your design flaw lies.
So when the page is submitted, the bean has long since been gone and cannot be retrieved from the servlet. This is basic HTTP.
Faisal A. Khan wrote:
Will "req" be long gone when it is used in the doPost method ? I doubt it . . . ! I am totally new to JSP but it really hunts me if we can not use these "req" and "res" objects.