Hi Ravi,
Although i couldn't find any details about setting request scoped attributes on page 416 on book (HFS&J, 2nd Edition). But as its been mentioned on the book that:
In a Servlet there are 3 scope objects:
1. request (HttpServletRequest)
2. session (HttSession)
3. context (ServletContext)
Note: There is NO 'page' scope object (unless the servlet is generated from the JSP) &
In a JSP there are a total of 4 implicit scope objects:
1. request (HttpServletRequest)
2. session (HttSession)
3. application (ServletContext), which is basically same as context from servlet
4. page (PageContext)
Note: The JSP adds an addition scope object 'page'.
Therefore, in terms of your question if you set a request attribute inside the servlet it will be stored in
the 'request' scope and can only be accessed from a 'request'.
If you try to access the same request attribute in your jsp using the <jsp:useBean/> you must explicitly specify
the scope as 'request'
If you don't explicitly specify the scope, it will look in the default which is 'page' and will return 'nothing'.
Regards,
Siphiwe Madi
[
SCJP, __, __]
Next ...
scwcd, scjwsd