Return-Path: Delivered-To: apmail-struts-user-archive@www.apache.org Received: (qmail 91569 invoked from network); 12 May 2010 14:03:46 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 12 May 2010 14:03:46 -0000 Received: (qmail 82811 invoked by uid 500); 12 May 2010 14:03:43 -0000 Delivered-To: apmail-struts-user-archive@struts.apache.org Received: (qmail 82786 invoked by uid 500); 12 May 2010 14:03:43 -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 82778 invoked by uid 99); 12 May 2010 14:03:43 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 12 May 2010 14:03:43 +0000 X-ASF-Spam-Status: No, hits=-3.4 required=10.0 tests=AWL,RCVD_IN_DNSWL_MED,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: local policy) Received: from [193.109.255.147] (HELO mail72.messagelabs.com) (193.109.255.147) by apache.org (qpsmtpd/0.29) with SMTP; Wed, 12 May 2010 14:03:37 +0000 X-VirusChecked: Checked X-Env-Sender: James.Cook@wecomm.com X-Msg-Ref: server-5.tower-72.messagelabs.com!1273672995!11629613!1 X-StarScan-Version: 6.2.4; banners=-,-,- X-Originating-IP: [62.244.190.146] Received: (qmail 22604 invoked from network); 12 May 2010 14:03:15 -0000 Received: from 62-244-190-146.cust.exponential-e.net (HELO lonex01.weComm.local) (62.244.190.146) by server-5.tower-72.messagelabs.com with SMTP; 12 May 2010 14:03:15 -0000 X-MimeOLE: Produced By Microsoft Exchange V6.5 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Subject: RE: Some Spring/Struts questions Date: Wed, 12 May 2010 15:03:15 +0100 Message-ID: <4FDDA327A6C64D4BB6B4670122AA8D4202264F59@lonex01.weComm.local> In-Reply-To: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Some Spring/Struts questions Thread-Index: Acrx2jskT7AV61f3Qeu419sSkzZAFwAAYlnA References: <28533505.post@talk.nabble.com> <4FDDA327A6C64D4BB6B4670122AA8D4202264F53@lonex01.weComm.local> From: "James Cook" To: "Struts Users Mailing List" Ah, awesome. Thank you for clearing that one up and your package is = defined in the struts.xml in the root of the source? -----Original Message----- From: Wes Wannemacher [mailto:wesw@wantii.com]=20 Sent: 12 May 2010 14:51 To: Struts Users Mailing List Subject: Re: Some Spring/Struts questions James, What I normally do is create a "package" and set the defaults that I want stuff to use (interceptors / interceptor stack / etc.). Then, I just tell the convention plugin to use the package I configured.... The list of properties that the plugin uses is here - http://struts.apache.org/2.x/docs/convention-plugin.html#ConventionPlugin= -Configurationreference I think the setting is - struts.convention.default.parent.package=09 -Wes On Wed, May 12, 2010 at 9:39 AM, James Cook = wrote: > That would be my favoured route. > > Wes, side question. Using the convention plugin can you modify the = stack > in the xml file so you don't have to annotate the action itself? Or do > you still have to add the annotation with the interceptor put in? > > James > > -----Original Message----- > From: Wes Wannemacher [mailto:wesw@wantii.com] > Sent: 12 May 2010 14:33 > To: Struts Users Mailing List > Subject: Re: Some Spring/Struts questions > > I've seen a few responses, but I think the best way would be to write > an interceptor that places the bean into the session. Give it a known > name in the session, then you can use OGNL to access it... Here is a > quick example of the interceptor - > > public class CustomInterceptor extends AbstractInterceptor { > > =A0 =A0private SomeBeanGeneratingService someBeanGeneratingService; > > =A0 =A0public String intercept(ActionInvocation invocation) throws > Exception { > =A0 =A0 =A0 invocation.getSession().put("knownBeanName", > someBeanGeneratingService.getBean()); > =A0 =A0 =A0 return invocation.invoke(); > =A0 =A0} > > =A0 =A0public void = setSomeBeanGeneratingService(SomeBeanGeneratingService > someBeanGeneratingService) { > =A0 =A0 =A0 =A0this.someBeanGeneratingService =3D = someBeanGeneratingService; > =A0 =A0} > } > > The benefit is using an interceptor is two-fold... One is that it's > pretty easy to unit test (compared to a Servlet Filter). Two is that > it can be spring-configured and spring-injected. > > With this interceptor putting the bean into the session, you can > access the bean's values through OGNL. Here is an example s:property > tag retrieving some property - > > > > Then, configure the interceptor and dependencies and put this > interceptor in your stack. > > -Wes > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-unsubscribe@struts.apache.org > For additional commands, e-mail: user-help@struts.apache.org > > --=20 Wes Wannemacher Head Engineer, WanTii, Inc. Need Training? Struts, Spring, Maven, Tomcat... Ask me for a quote! --------------------------------------------------------------------- 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