aspose file tools*
The moose likes Struts and the fly likes Does ValueStack overflows at some time Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Struts
Bookmark "Does ValueStack overflows at some time" Watch "Does ValueStack overflows at some time" New topic
Author

Does ValueStack overflows at some time

MaheshS Kumbhar
Ranch Hand

Joined: Sep 24, 2009
Posts: 188
I have a very basic question that could be really silly but I am curious to know this

Suppose we have one web application, where several objects are put into Value stack during its operation. My question, is does Value stack overflow at some time?

Please guide me if I am wrong.


I am slow but sure
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8710
    
    6

Stack overflow refers to a particular condition, that is the call stack has exceeded the maximum allowable size, usually due to recursion.
The Value Stack in Struts 2 is a different kind of mechanism, just holding the values for a single HTTP request, so I would venture to say that in normal use it cannot "overflow".


"blabbing like a narcissistic fool with a superiority complex" ~ N.A.
[How To Ask Questions On JavaRanch]
MaheshS Kumbhar
Ranch Hand

Joined: Sep 24, 2009
Posts: 188
Hi Joe
Does this mean, if one action class puts an one object onto value stack and its result page jsp displays that object put onto top of value stack; this way one http request response completes. Now user makes another request by clicking some link on that jsp page which will invoke different action class and in turn will act as new http request. Now my question is, cant this new action's result type(JSP page) access the object put on value stack by first action?
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8710
    
    6

No it cannot. If you want to persist values between requests, you'll need to use the session or some other persistence mechanism (file, database, etc.).
MaheshS Kumbhar
Ranch Hand

Joined: Sep 24, 2009
Posts: 188
If we need to maintain the session, so that different actions results can access the objects created by one action, then these objects need to be saved in session object or in the value stack itself?
And once again I want to inturrupt the same topic.
I had read on apache struts site that said,
"If you are looking for an object then Struts will look into the whole value stack for the object. If you directly specify a property, then its looked only into the object which is on top of the value stack."

Here they told that, struts will look into the whole value stack for the object we specify until it finds, then is this information is with respect to single http request response cycle.
Joe Ess
Bartender

Joined: Oct 29, 2001
Posts: 8710
    
    6

MaheshS Kumbhar wrote:If we need to maintain the session, so that different actions results can access the objects created by one action, then these objects need to be saved in session object or in the value stack itself?


I think I said: "If you want to persist values between requests, you'll need to use the session or some other persistence mechanism". The ValueStack only holds values for a single request.

MaheshS Kumbhar wrote:
Here they told that, struts will look into the whole value stack for the object we specify until it finds, then is this information is with respect to single http request response cycle.


Again, the ValueStack only holds values for a single request.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Does ValueStack overflows at some time
 
Similar Threads
strong reference
how to programe a stack process for first in and last out!
S2:Passing List through param tag
Concept about Memory storage and thread
object saved in request/session