• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

c:set and scope

 
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What is the difference between the two items below?



I thought that test1 would be available to me once I posted to my servlet. It's not so it seems to me that test1 and test2 above behave the same. What am I missing?

Jay
 
Ranch Hand
Posts: 783
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Attributes in request scope are available to any jsp page or servlet that are part of the specific request chain. For instance, if I made a GET request to servlet1, which forwarded to servlet2, which forwarded to jsp3, etc... attributes put in request scope in servlet1 would be available in jsp3 as well.

Attributes in page scope are accessible only within the specific JSP page and is destroyed when the page has finished generating its output for the request. Page scope is usually used with custom tags, and it is a way to pass data from the jsp page to the custom tag.
 
J Haley
Ranch Hand
Posts: 66
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I had that same understanding as what you described, that�s why I�m confused.

I have the following code in a jsp that submits to a struts action.



Since scope is set to request, I would expect that I would have a handle to �test1� by using request.getAttribute(�test1�); in my action that I�m posting to. I don�t and that�s what I don�t understand.

Jay
 
Ranch Hand
Posts: 118
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
u will get it using request.getParameter instead of getAttribute
 
I've read about this kind of thing at the checkout counter. That's where I met this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic