我的理解是在配置文件里配置了返回JSTL那么我对应的文件应该可以直接使用JSTL了,但我测试了还是不行!<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="viewClass"
value="org.springframework.web.servlet.view.JstlView" />

<property name="prefix" value="/myPages/" />
<property name="suffix" value=".jsp" />
</bean>
我在返回的JSP上应用了JSTL的标签库是可以用,但如果不引用还是不行。另 我把那句"viewClass" 去掉还是能用JSTL,如果我页面中引用了的话那="viewClass"的作用是什么???

解决方案 »

  1.   

    看看说明文档Convenient subclass of UrlBasedViewResolver that supports InternalResourceView (i.e. Servlets and JSPs) and subclasses such as JstlView and TilesView.The view class for all views generated by this resolver can be specified via UrlBasedViewResolver.setViewClass(java.lang.Class). See UrlBasedViewResolver's javadoc for details. The default is InternalResourceView, or JstlView if the JSTL API is present.BTW, it's good practice to put JSP files that just serve as views under WEB-INF, to hide them from direct access (e.g. via a manually entered URL). Only controllers will be able to access them then. 
      

  2.   

    我把那句"viewClass" 去掉还是能用JSTL,``
      

  3.   

    有没搞错....你的applicationContext.xml文件配置肯定有问题
    一看就知道