• Post Reply Bookmark Topic Watch Topic
  • New Topic

request AND requestScope  RSS feed

 
Arul Jose
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I read that request is not requestScope.

we have two different objects. what is the difference?

when we say request.setAttribute, where do we actually set the attribute? in request or in requestScope?

:roll:
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66144
144
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When you say requestScope, are you talking about the EL implicit variable of that name?

If not, then I know not what you are asking.

If so, the requestScope implicit variable is a Map of all of the scoped variables stored on the current request.
[ July 10, 2005: Message edited by: Bear Bibeault ]
 
Arul Jose
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i read in 'head first servlets & jsp', that request is not requestScope. they are different objects.

any idea.

jose.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66144
144
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you not read my reply?
 
Arul Jose
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what is that "JSTL implicit variable"? i have not gone int jstl yet. bye the time you read this mail, may be I would have known something in jstl.

jose.

:roll:
 
Stefan Evans
Bartender
Posts: 1836
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try it like this.
Request object encapsulates the request to the server. It has all the information about url requested, parameters passed, a link to the session, and all the attributes associated with this request.

Request Scope merely refers to the attributes associated with this request - ie only PART of the information that a request does.

In JSP you have four attribute scopes: page, request, session and application scopes, to specify the attributes at each level.

The variable ${requestScope} is an EL variable defined by the JSP page to give easy access to the attributes in request scope.
Using it is equivalent to request.getAttribute().

ie
<%= request.getAttribute("test") %>
is equivalent to
${requestScope.test}

Cheers,
evnafets
 
Arul Jose
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you, you have really helped me.

jose
 
Arul Jose
Ranch Hand
Posts: 131
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
do you mean to say that requestScope is another object created by the container to contain the attributes of the request object?

if so what is the use? why not use the request object itself?
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!