jsp json 輸出


<%@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);

%>
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章