由于没有用MVC框架,所以在view层的不能由Spring依赖注入,现在我jsp页面又想引用Spring管理的Bean,那怎么办。用WebApplicationContextUtils帮助类。jsp页面如下:
<%
@ page language
=
"
java
"
pageEncoding
=
"
UTF-8
"
%>
<% @ page import = " org.springframework.web.context.support.WebApplicationContextUtils " %>
<% @ page import = " org.springframework.web.context.WebApplicationContext " %>
<%
WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext( this .getServletContext());
%>
<% @ page import = " org.springframework.web.context.support.WebApplicationContextUtils " %>
<% @ page import = " org.springframework.web.context.WebApplicationContext " %>
<%
WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext( this .getServletContext());
%>