Re: s2 + spring, how to access spring defined bean in jsp
I found this interesting filter that I could apply: http://wiki.opensymphony.com/display/ABLE/Expose+Spring+Beans+in+JSP I'm kind of surprised that spring or struts doesn't already have something to provide this built in. --tom - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: s2 + spring, how to access spring defined bean in jsp
Or possibly use Spring's ability to put beans into web scopes? I guess I"m not sure how the bean is named in the scope or if it's even available as a scoped attribute. I'd kinda *like* to know, though... kinda like... wait for it... A scopes trial. Totally worth it. Dave --- On Fri, 6/6/08, Chris Pratt <[EMAIL PROTECTED]> wrote: > From: Chris Pratt <[EMAIL PROTECTED]> > Subject: Re: s2 + spring, how to access spring defined bean in jsp > To: "Struts Users Mailing List" > Date: Friday, June 6, 2008, 2:13 PM > You can also add an Interceptor that places the bean in the > context. Like: > > invocation.getStack().getContext().put("user",userBean); > > Then in your jsp's you can reference the value using > the Struts tags as: > > > > (*Chris*) > > On Fri, Jun 6, 2008 at 11:00 AM, Bob Tiernay > <[EMAIL PROTECTED]> wrote: > > > > I would recommend either of the following: > > > > 1. Use a jstl function that gets the application > context and resolves the bean by name > > 2. Use a tagfile to wrap a scriptlet (or call to 1.) > that does the lookup, using the bean name as an > attribute.> Date: Fri, 6 Jun 2008 13:36:16 -0400> > From: [EMAIL PROTECTED]> To: > user@struts.apache.org> Subject: s2 + spring, how to > access spring defined bean in jsp> > I have a spring > defined singleton bean that I want to access in> several > jsp's. I'd like to simply do something like > ${bean.property}> wherever I need it.> > > What's the easiest way that doesn't involve adding > a getter in the> action class (I'm using the > codebehind plugin and tiles plugin for> some of the > jsp's so I don't have action classes defined for > all> jsp's).> > --tom> > > -> > To unsubscribe, e-mail: > [EMAIL PROTECTED]> For additional > commands, e-mail: [EMAIL PROTECTED]> > > > _ > > > > > > - > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: s2 + spring, how to access spring defined bean in jsp
You can also add an Interceptor that places the bean in the context. Like: invocation.getStack().getContext().put("user",userBean); Then in your jsp's you can reference the value using the Struts tags as: (*Chris*) On Fri, Jun 6, 2008 at 11:00 AM, Bob Tiernay <[EMAIL PROTECTED]> wrote: > > I would recommend either of the following: > > 1. Use a jstl function that gets the application context and resolves the > bean by name > 2. Use a tagfile to wrap a scriptlet (or call to 1.) that does the lookup, > using the bean name as an attribute.> Date: Fri, 6 Jun 2008 13:36:16 -0400> > From: [EMAIL PROTECTED]> To: user@struts.apache.org> Subject: s2 + spring, > how to access spring defined bean in jsp> > I have a spring defined singleton > bean that I want to access in> several jsp's. I'd like to simply do something > like ${bean.property}> wherever I need it.> > What's the easiest way that > doesn't involve adding a getter in the> action class (I'm using the > codebehind plugin and tiles plugin for> some of the jsp's so I don't have > action classes defined for all> jsp's).> > --tom> > > -> To > unsubscribe, e-mail: [EMAIL PROTECTED]> For additional commands, e-mail: > [EMAIL PROTECTED]> > _ > > - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: s2 + spring, how to access spring defined bean in jsp
I would recommend either of the following: 1. Use a jstl function that gets the application context and resolves the bean by name 2. Use a tagfile to wrap a scriptlet (or call to 1.) that does the lookup, using the bean name as an attribute.> Date: Fri, 6 Jun 2008 13:36:16 -0400> From: [EMAIL PROTECTED]> To: user@struts.apache.org> Subject: s2 + spring, how to access spring defined bean in jsp> > I have a spring defined singleton bean that I want to access in> several jsp's. I'd like to simply do something like ${bean.property}> wherever I need it.> > What's the easiest way that doesn't involve adding a getter in the> action class (I'm using the codebehind plugin and tiles plugin for> some of the jsp's so I don't have action classes defined for all> jsp's).> > --tom> > -> To unsubscribe, e-mail: [EMAIL PROTECTED]> For additional commands, e-mail: [EMAIL PROTECTED]> _