Example of getting Spring injection object from JSP, jspspring
<% @ Page import = "org. springframework. web. context. support. webApplicationContextUtils "%> <% @ page import =" org. springframework. context. applicationContext "%> ServletContext SC = this. getServletConfig (). getServletContext (); ApplicationContext ac2 = WebApplicationContextUtils. getWebApplicationContext (SC );
Serv = (object to be retrieved) ac2.getBean ("id in spring configuration file ");
How does jsp obtain bean objects when spring25 uses annotation?
WebApplicationContext ctx = WebApplicationContextUtils. getRequiredWebApplicationContext (request). getSession (). getServletContext ());
AdvertiseService advertiseService = (AdvertiseService) ctx. getBean ("advertiseService ");
This is to call a service in the container
How to obtain the service object declared using spring annotation in jsp
Where did you write this method? Send a log original sentence