Forums Register Login

c:set and scope

+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
u will get it using request.getParameter instead of getAttribute
Normally trees don't drive trucks. Does this tiny ad have a license?
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com


reply
reply
This thread has been viewed 893 times.
Similar Threads
unable to set attribute using <c:set> using the body
c:set target doubt
Doubt about Unknown Attributes in EL
c:remove
NoClassDefFoundError with c:set using body content
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 18, 2024 21:50:29.