jsp页面的代码:
复制代码 代码如下:
<%@ page contentType="text/html; charset=gbk"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<% String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + request.getContextPath() + "/";
out.println(basePath);
%>
请选择部门类型
请选择文件类型
struts中action的代码
复制代码 代码如下:
public String getJsonCategory() throws IOException{
rfjsons=archiveService.getCategoryByParentID(parentId);//这里从数据库取得数据
net.sf.json.JSonArray jsonObj=net.sf.json.JSONArray.fromObject(rfjsons);//组装成json数据
sendMessage(jsonObj.toString());//向视图push json数据
return null;
}
public void sendMessage(String content) throws IOException{
HttpServletResponse response = ServletActionContext.getResponse();
response.setCharacterEncoding("UTF-8");
response.getWriter().write(content);
}



