wood burning stoves 2.0*
The moose likes JSP and the fly likes got confused with requstscope and param Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "got confused with requstscope and param" Watch "got confused with requstscope and param" New topic
Author

got confused with requstscope and param

Shashi Prakash
Ranch Hand

Joined: Mar 28, 2007
Posts: 40
Hi,

Can anybody please explain me.. what is requestscope and what is param .. and when parameters will go to requestscope..when Should we excess values from requestscope and when from param..


Thanks,<br />Target Scwcd<br />SCJP 1.4
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60822
    
  65

Parameters are submissions to the request. They can either be fields from a form, or data on the query string. Parameters have nothing to do with request scope.

Scoped variables are Java objects placed in a scoped context (such as request scope) by code using the setAttribute() method of the scoped contexts.
[ August 01, 2007: Message edited by: Bear Bibeault ]

[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Shashi Prakash
Ranch Hand

Joined: Mar 28, 2007
Posts: 40
So this means if I am passing some parameters to include page soemthing like this --

<jsp:include page="elements/comments_display_inc.jsp">
<jsp:param name="url" value="deal_journal.jsp"/>
<jsp:param name="dealDescriptionId" value="${param['dealDescriptionId']}"/>
<jsp:param name="entityType" value="Deal"/>
<jsp:param name="entityCode" value="${resolver['/util/paramHash'].dealId}"/>

</jsp:include>

then i can't access entityType, entityCode and others usinf requestscope.. I should use param only...
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

Correct, those would be parameters (just the same as if they were part of the query string). Which, I believe, is how jsp:param is implemented in Tomcat.




[BONK]
[ August 01, 2007: Message edited by: Ben Souther ]

Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 60822
    
  65

Correct. Parameters have nothing to do with request scope.
Shashi Prakash
Ranch Hand

Joined: Mar 28, 2007
Posts: 40
Thanks for confirmation..
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: got confused with requstscope and param
 
Similar Threads
request AND requestScope
Doubts
Confuse yet!!!
Properties vs. Attributes
Detecting selected html options using Struts and JSTL?