This week's giveaway is in the Programmer Certification (OCPJP) forum.
We're giving away four copies of Java Mock Exams (software) and have David Mayer on-line!
See this thread for details.
Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

requestScope VS request object

 
Satyajeet Kadam
Ranch Hand
Posts: 224
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Q1)I want to know the difference between requestScope VS request object?
Q2)Page 384 Head first Don't confuse the Map Scope objects to the objects with attributes are bound? please explain this with example?
Q3) what difference between Implict objects in El vs Jsp implicit object



Jsp implcit object Servlet
for example)

appplication.setAttribute()==> ServletContext.setAttribute() in servlets
 
James Mark
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Consider the request Scope ....

the idea is getting the attribute bound to the HttpServletRequest object.
the equivalent in jsp implicit object is request
instead of using the getAttribute(String) on the request object...

just use the requestScope EL implicit object.....but how?
Either use . or [] operator upon requestScope to get the Object(or even its property) bound to the HttpServletRequest object.
remember request is used in the jsp pages to refer the HttpServletRequest object....

Keep Cool dont get carried away!!!

 
James Mark
Ranch Hand
Posts: 115
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
as an Example.....
<html>
<%
String [] noises = {"Lion","Tiger","Cat"};
request.setAttribute("noises",noises);
%>
${requestScope.noises[0]}
${requestScope.noises["0"]}
${requestScope.noises['0']}
${noises[0]}
${noises["0"]}
${noises['0']}
</html>

if you are not specifying any scopes... the search will be performed in different Scopes in page,request,session,application Order...
 
Raghavan Muthu
Ranch Hand
Posts: 3381
Mac MySQL Database Tomcat Server
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please have a look at this thread which has a discussion on "Implicit Variables Vs Implicit Objects".

It might give you some hints.
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!