In some MVC frameworks you can call controller action from the view if you wish to execute some code and render some partial view. I\'m not sure what is the correct way to d
Spring-MVC can expose the application context's beans to the view layer, if that is what you wish to do.
For example, the InternalResourceViewResolver
can be instructed to expose every bean in the context, or just specified ones. Take a look at the exposeContextBeansAsAttributes and exposedContextBeanNames properties.
For example, say you wanted to expose the beans beanA
and beanB
to your JSPs. You would declare the view resolver in your context thus:
beanA
beanB
Alternatively, to just expose every bean:
Whether or not this is a good idea is another question, but Spring does give you the option.