aspose file tools*
The moose likes Web Component Certification (SCWCD/OCPJWCD) and the fly likes c:set and scope Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Web Component Certification (SCWCD/OCPJWCD)
Bookmark "c:set and scope" Watch "c:set and scope" New topic
Author

c:set and scope

J Haley
Ranch Hand

Joined: Jul 22, 2004
Posts: 66
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
Paul Bourdeaux
Ranch Hand

Joined: May 24, 2004
Posts: 783
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.


“Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.” - Rich Cook
J Haley
Ranch Hand

Joined: Jul 22, 2004
Posts: 66
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
geeta lalchandani
Ranch Hand

Joined: Jun 07, 2005
Posts: 118
u will get it using request.getParameter instead of getAttribute
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: c:set and scope