Return-Path: Delivered-To: apmail-struts-user-archive@www.apache.org Received: (qmail 8692 invoked from network); 19 Apr 2008 17:43:47 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 19 Apr 2008 17:43:47 -0000 Received: (qmail 50005 invoked by uid 500); 19 Apr 2008 17:43:38 -0000 Delivered-To: apmail-struts-user-archive@struts.apache.org Received: (qmail 49980 invoked by uid 500); 19 Apr 2008 17:43:38 -0000 Mailing-List: contact user-help@struts.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Help: List-Post: List-Id: "Struts Users Mailing List" Reply-To: "Struts Users Mailing List" Delivered-To: mailing list user@struts.apache.org Received: (qmail 49969 invoked by uid 99); 19 Apr 2008 17:43:38 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 19 Apr 2008 10:43:38 -0700 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of themakii@googlemail.com designates 209.85.146.178 as permitted sender) Received: from [209.85.146.178] (HELO wa-out-1112.google.com) (209.85.146.178) by apache.org (qpsmtpd/0.29) with ESMTP; Sat, 19 Apr 2008 17:42:52 +0000 Received: by wa-out-1112.google.com with SMTP id n7so1710135wag.5 for ; Sat, 19 Apr 2008 10:43:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; bh=RJDlhO96QG4K/Qm6HF1OivrXdrjugMDzKuYWybDdLMU=; b=hqUn0oljQ3tgK6ZgcIMnuE7LFMhSWu44xDWocxmN9pvVgUdk+VfaaxM2G3ve97iDt+2H3nJLk+EFVUmQRqqbTKxdb6svHukZuaIVQ6KhIEXSTaeiguoh5KHX4OOHa0YIUh4tadWmyr4eTHj/yqex6vDs7Yov0nWkLnZtL/z2z0g= DomainKey-Signature: a=rsa-sha1; c=nofws; d=googlemail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=cdjROXLnvwSmzjhggrKTmJX2o2WycIsfHO5bo55jvnoYi6YekyIx9Se5L91KkYpG1PFMVjEsqgrv92at3SvG7UkxjTDDgZD+paQ8FCUIpcTJyDsVPr6HIKpdLnKPMyxDaNevpGS/4wsvfV7fCmbrXTiK3AbF8hSRgy+bc4paG8U= Received: by 10.115.95.1 with SMTP id x1mr1099590wal.7.1208626985104; Sat, 19 Apr 2008 10:43:05 -0700 (PDT) Received: by 10.115.60.20 with HTTP; Sat, 19 Apr 2008 10:43:05 -0700 (PDT) Message-ID: <1b55629d0804191043o35a455aekc5d7cec61d1b4c36@mail.gmail.com> Date: Sat, 19 Apr 2008 19:43:05 +0200 From: "Ralf Fischer" To: "Struts Users Mailing List" Subject: Re: from Action to PageContext: how's it done? In-Reply-To: <480A2BEE.10909@cyberspaceroad.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <480A2BEE.10909@cyberspaceroad.com> X-Virus-Checked: Checked by ClamAV on apache.org 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. 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