• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

requestScope VS request object

 
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
 
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...
 
Ranch Hand
Posts: 3389
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.
 
My honeysuckle is blooming this year! Now to fertilize this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic