|
From: Colin S. <col...@ex...> - 2005-06-02 08:07:49
|
Well here you're getting into view templating technology. JSTL simply won't let you do arbitrary method invocations in expressions. This is a fundamental limitation you can't get around short of switching to another view technology (Velocity or FreeMarker for example will let you do method invocations in their expression language. In a JSP page you'll have to use a scriptlet instead (ughh!). The new JSP 2.1/JSTL also allow you to define accessor methods of some sort. It's still quite clunky and way to much work. I've had this argument (about how useless JSTL is) a number of times with people, most recently here: http://www.theserverside.com/news/thread.tss?thread_id=33990#171263 Keith Donald wrote: >Juergen, > >I should clarify: I meant from a view template like a .jsp, not a mvc View >instance. Basically I have some beans in a flow-scoped application context. >Because the AC is in flow scope, I can access it like this from view >resources participating in the flow. Ideally I'd like to be able to invoke >arbitrary methods on certain beans, like this: > >${transactionContext.transactionCoordinator.amountDeposited}, which would >translate to: ac.getBean("transactionCoordinator").getAmountDeposited(). > >Keith > >-----Original Message----- >From: spr...@li... >[mailto:spr...@li...] On Behalf Of >Juergen Hoeller >Sent: Wednesday, June 01, 2005 2:58 PM >To: spr...@li... >Subject: Re: [Springframework-developer] am I missing something > >Keith, > >If you define your View instances as beans (using XmlViewResolver or >ResourceBundleViewResolver), you can wire them with anything you want, using >standard Spring bean references. > >However, if you're using a UrlBasedViewResolver, this is not available >because of the different View instantiation model there. You can do >ApplicationContext lookups in an ApplicationContextAware view, though. > >What concretely do you want to pass to a View instance? > >Juergen > > >-----Original Message----- >From: spr...@li... >[mailto:spr...@li...]On Behalf Of >Keith Donald >Sent: Wednesday, June 01, 2005 2:31 AM >To: spr...@li... >Subject: [Springframework-developer] am I missing something > > >Is there an easy way to invoke methods on a bean exported in the Spring >application context from a view? It'd be quite useful for this app I'm >building. I reckon I could just stick the service I want to expose into the >model but it'd be cool to have the whole context in there in this case.. I >know we also want this capability in web flow definitions as well. > >Keith > > > > > >------------------------------------------------------- >This SF.Net email is sponsored by Yahoo. >Introducing Yahoo! Search Developer Network - Create apps using Yahoo! >Search APIs Find out how you can build Yahoo! directly into your own >Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005 >_______________________________________________ >Springframework-developer mailing list >Spr...@li... >https://lists.sourceforge.net/lists/listinfo/springframework-developer > > > >------------------------------------------------------- >This SF.Net email is sponsored by Yahoo. >Introducing Yahoo! Search Developer Network - Create apps using Yahoo! >Search APIs Find out how you can build Yahoo! directly into your own >Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005 >_______________________________________________ >Springframework-developer mailing list >Spr...@li... >https://lists.sourceforge.net/lists/listinfo/springframework-developer > > |