pageEncoding="UTF-8"%>
字串路徑= request.getContextPath();
字串basePath = request. getScheme () "://" request.getServerName() ":" request.getServerPort() 路徑"/";
%>
在此處插入標題
2.存取操作代碼如下
public class JsonAction extends ActionSupport> () 拋出IOException
{
HttpServletRequest req = ServletActionContext.getRequest();
String p1 = req.getParameter("param1");
;
HttpServletResponse rep = ServletActionContext.getResponse();
rep.setContentType("text/json;charset=utf-8"); String data = "[{"id":"01","name":"zhongqian","description":"" p1""},{"id":"02","name":"zhangsan" , "description":"" p2 ""}]";
pw.print(data);
pw.flush();
}
}
}
}
}
3.效果如下: