struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ralf Fischer" <>
Subject Re: from Action to PageContext: how's it done?
Date Sat, 19 Apr 2008 17:43:05 GMT
Hello Adam

On Sat, Apr 19, 2008 at 7:29 PM, Adam Hardy
<> wrote:
> From looking at the struts2 architecture, one of the big questions that I
> can't find the answer to is how struts/xwork moves objects such as the
> properties on an action into the PageContext.

Actually it's not done at all. I guess your real question is "I create
some objects in my action and want to render them somehow in the view.
How do I do that?"

Upon request to your struts web application the filter creates a value
stack which holds all the information needed. The action responsible
for the "page" of I may say so is put onto the stack and the single
interceptors on the stack set the parameters from the configuration or
the requested URI into the stack. Usually this leads to the population
of action properties if you did everything right, meaning the URI
parameter  ?foo=1 will lead to a call of setFoo("1").

The same stack is still available when the result associated with the
action is rendered, which may be a JSP page, and you can access
information easily by using OGNL expressions to extract the
information you need.

>  When an interceptor is executing for example, calling
> ServletActionContext.getPageContext() will return null until the action has
> been  invoked.

Is there a page context yet when you are some method calls away from a
servlet filter?

>  Invoking the action also executes the Result, so the JSP is called and the
> PageContext is created.
>  But how does struts do that? I've got a feeling my knowledge of the Servlet
> Container could be better :(

I suggest some basic reading on struts, here[1] for example.



To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message