struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ralf Fischer" <thema...@googlemail.com>
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
<ahardy.struts@cyberspaceroad.com> 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.

Cheers,
-Ralf

[1] http://struts.apache.org/2.0.11.1/docs/home.html

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message