jsp中使用spring中的bean
<%@ page import="org.springframework.context.ApplicationContext" %>
<%@ page import="org.springframework.web.context.support.WebApplicationContextUtils" %>
<body>
<%
ApplicationContext ctx = WebApplicationContextUtils.getWebApplicationContext(getServletContext());
com.demo.service.UserService userService=(com.demo.service.UserService) ctx.getBean("userService");
System.out.println("------------->"+userService.getMessage());
%>
</body>