jsp访问spring对象

来源:互联网 发布:天津办公软件培训 编辑:程序博客网 时间:2024/05/01 15:13
 
<%@page language="java" import="java.util.*" pageEncoding="utf-8"%><%@page import="org.springframework.context.ApplicationContext"%><%@page import="org.springframework.web.context.support.WebApplicationContextUtils"%><%@page import="ccp.suddenattack.service.news.*"%><%@page import="com.netstar8.util.page.*"%><%@page import="net.sf.json.*"%><%ApplicationContext context=WebApplicationContextUtils.getWebApplicationContext(application);NewsService newsService = (NewsService)context.getBean("newsService");PaginationSupport ps = newsService.findAllNews(10,0);//out.println(ps.getTotalCount());JSONObject jsonObject = JSONObject.fromObject(ps);String jsonStr = "json503="+jsonObject.toString();out.println(jsonStr);%>
原创粉丝点击