-
Notifications
You must be signed in to change notification settings - Fork 38.6k
Description
Scott Murphy opened SPR-8064 and commented
InternalResourceViewResolver has the ability to inject beans into a view. This is very useful if you have some beans that have static content you want to render in all of your views.
#9244 implemented setExposedContextBeanNames(String[] exposedContextBeanNames) on InternalResourceViewResolver.
This was good, but limits to only using an InternalResourceViewResolver.
If you are using a org.springframework.web.servlet.view.UrlBasedViewResolver with Tiles
you have to come up with your own solution like here
http://stackoverflow.com/questions/2848415/accessing-spring-beans-from-a-tiles-view-jsp.
Since InternalResourceViewResolver extends UrlBasedViewResolver, why not just have UrlBasedViewResolver implement setExposedContextBeanNames(String[] exposedContextBeanNames) AND setExposeContextBeansAsAttributes(boolean exposeContextBeansAsAttributes) ?
If possible, maybe even move the methods all the way to org.springframework.web.servlet.view.AbstractCachingViewResolver ?
Affects: 3.0.5, 3.0.6, 3.1 M1
Attachments:
- ContextExposingViewResolver.java (2.94 kB)
Issue Links:
- [InternalResourceView] Allow exposeContextBeansAsAttributes to be applied to specific beans [SPR-4567] #9244 [InternalResourceView] Allow exposeContextBeansAsAttributes to be applied to specific beans
Referenced from: commits a05b748
5 votes, 4 watchers