This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Hai All! What are advatages of having page scope beans instead of request scoped variables? Also pls advise me if there are any pitfalls in using page scope as i am facing some problems in using page scrope..
Well, I guess one advantage would be that your request objects will have fewer attributes to carry around. What exactly are the problems you are facing? The only pitfall I can think of right now is not having a clear idea of the difference between the lifetime/scope of a bean that has page scope vs. request scope. Remember, JSPs are translated into servlets. Beans that have page scope are local objects created in the generated service() method. Page-scoped beans go away when execution of the service() method termininates. OTH, beans that have request scope are kept in the request object which is passed to the service() method. They are available in the service() method through request.getAttribute("bean name"). They remain available as long as the request object is available. That means if you are doing forwards, the same request-scoped bean will be available to the JSP/servlet you forward to. HTH ------------------ Junilu Lacar Sun Certified Programmer for the Java� 2 Platform