问题描述
我刚开始使用Spring。我遇到了很多教程。
我看到使用 InternalResourceViewResolver
而不是 UrlBasedViewResolver
的更多示例。我查看了Spring文档,但我无法弄清楚使用其中一个的好处。有人可以提供一些解释吗?
I just started using Spring. I came across a lot tutorials.I saw more examples using InternalResourceViewResolver
than UrlBasedViewResolver
. I looked at the Spring documentation, but I can't figure out the benefit of using one or the other. Can someone provide some explanation?
推荐答案
是一个方便的子类 UrlBasedViewResolver
。
JavaDoc描述了 InternalResourceViewResolver $ c中的一些添加属性$ c>在某些情况下可能有用:
The JavaDoc describes some added properties in InternalResourceViewResolver
that might be useful in some situations:
AlwaysInclude
:控制是否已完成转发或包含。
AlwaysInclude
: Controls whether either a forward or include is done.
ExposeContextBeansAsAttributes
:允许上下文中的所有bean作为请求属性使用,这意味着它们可以从JSP中的EL引用。
ExposeContextBeansAsAttributes
: Allows all beans in context to be available as request attributes, which means they can be referenced from the EL in JSP.
ExposedContextBeanNames
:如果为非null,则指定将公开的bean列表,而不是所有bean。
ExposedContextBeanNames
: If non-null, specifies the list of beans that will be exposed, as opposed to all of them.
来自春季论坛的消息来源:
Source from spring forum : Spring Q&A forum
这篇关于InternalResourceViewResolver与UrlBasedViewResolver有何不同的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!