Return-Path: Delivered-To: apmail-struts-user-archive@www.apache.org Received: (qmail 84133 invoked from network); 30 Nov 2006 22:30:45 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 30 Nov 2006 22:30:44 -0000 Received: (qmail 58629 invoked by uid 500); 30 Nov 2006 22:30:32 -0000 Delivered-To: apmail-struts-user-archive@struts.apache.org Received: (qmail 58540 invoked by uid 500); 30 Nov 2006 22:30:31 -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 58475 invoked by uid 99); 30 Nov 2006 22:30:31 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 30 Nov 2006 14:30:31 -0800 X-ASF-Spam-Status: No, hits=-0.0 required=10.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (herse.apache.org: domain of donald.brown@gmail.com designates 64.233.166.180 as permitted sender) Received: from [64.233.166.180] (HELO py-out-1112.google.com) (64.233.166.180) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 30 Nov 2006 14:30:20 -0800 Received: by py-out-1112.google.com with SMTP id u52so1881780pyb for ; Thu, 30 Nov 2006 14:30:00 -0800 (PST) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:content-transfer-encoding:content-disposition:references; b=KQIFZrCkFHnK4mxuVQIKGIwKy/uDFdh12q/+CZAtYJopYanqgnc6Fmp43Blw0zUQr/3IMDRnmSyfnywzUybKxfT+/TNg0qABkFQEJOyZBbh51M2dL+nEi/Le4LDfW223TPvuuuX91hdZovpMmzpGzZtKRbdMHsfB4sleV72Ng7Q= Received: by 10.35.121.2 with SMTP id y2mr7312319pym.1164925799825; Thu, 30 Nov 2006 14:29:59 -0800 (PST) Received: by 10.35.112.6 with HTTP; Thu, 30 Nov 2006 14:29:59 -0800 (PST) Message-ID: <1c661f2f0611301429r6f47f963q640e60e9166d0249@mail.gmail.com> Date: Thu, 30 Nov 2006 14:29:59 -0800 From: "Don Brown" To: "Struts Users Mailing List" Subject: Re: Struts 2 and passing data using interceptors In-Reply-To: <7627298.post@talk.nabble.com> MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline References: <7627298.post@talk.nabble.com> X-Virus-Checked: Checked by ClamAV on apache.org If you only need request-scoped data, you don't need to bother with the ScopeInterceptor or even the ServletRequestAware interface. Simply define a getter on your action that returns the object in question, then access it via your JSP via JSP EL (JSP 2.0), a JSTL expression, or a Struts 2 property tag. Don On 11/30/06, fahlen wrote: > > Hi. I'm new to Struts and have a question regarding how data is passed from > an Action (in Struts 2) to the JSP which one is redirected to after the > action is executed. Reading the documentation on Struts 2, I've found that > using the Scope Interceptor one can specify Action properties to be bound to > the session or application scope. This is configured in struts.xml with the > tag and then setting the appropriate > parameters. See http://www.twdata.org/backups/WW/scope-interceptor.html > > Now, say I access an EJB from an Action. The method of the EJB returns some > data. Is it good programming practice (in Struts) to store this data in the > session object, later to be accessed from a JSP? This should allow me to > pass the data, but perhaps there is some other alternative which is > preferred. Storing information in the session object would maybe be good > practice for data such as user id, contents of a shopping cart, etc. The > scope I believe I am interested in is request scope, since the data returned > from the invoked EJB method is data from an Amazon.com search, only to be > used in the JSP displayed immediately after the execution of the Action. > > Would the preferred method in my case then be to implement the > ServletRequestAware interface in the Action and store data of interest in > the request object? I can't find any interceptor that does this. I'm sure > one can create user defined interceptors, but if there's a standard method > for this functionality provided by the framework, then I guess that would be > the preferred way to go. > > I'm grateful for any input on the matter. Cheers. > -- > View this message in context: http://www.nabble.com/Struts-2-and-passing-data-using-interceptors-tf2734105.html#a7627298 > Sent from the Struts - User mailing list archive at Nabble.com. > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org > For additional commands, e-mail: user-help@struts.apache.org > > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@struts.apache.org For additional commands, e-mail: user-help@struts.apache.org