| Author |
bean not found within request scope, but session scope
|
Yan Zhou
Ranch Hand
Joined: Sep 02, 2003
Posts: 136
|
|
Hi there, I have A.jsp that creates a request scope bean and a form. A servlet responds to form submit, and the servlet simply forwards the request to B.jsp, which uses the request scope bean. I am getting error "bean my not found within scope". However, if I change the scope to "session", then everything works. What I do not understand is why "request" scope does not work since both A and B are on the same request. As I debug the doGet() method of the servlet, I noticed that there is no attribute in the HttpServletRequest object parameter of doGet(), should not there be the bean I just created? What am I missing? Thanks. Yan
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56168
|
|
What I do not understand is why "request" scope does not work since both A and B are on the same request.
They are not in the same request. The first request ends when A is sent to the browser. The second request, in which you are noticing that no request attribute is available, is created when the form is submitted. [ October 31, 2005: Message edited by: Bear Bibeault ]
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56168
|
|
|
Perhaps this JavaRanch Journal article which outlines the life cycle of a JSP might be instructive.
|
 |
 |
|
|
subject: bean not found within request scope, but session scope
|
|
|