/*
* Ts.java
*
* Version 1.0
*
* Created on 2009-1-13
*
* 时力永联科技有限公司
* 北京市海淀区中关村南大街乙56号方圆大厦9层
* 电话:88026633
* 传真:88026633-291
* 邮编:100044
* 版权所有
*/
/**
* Ts.java
*/
package se;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
* @author keroro
*/
public class Ts extends HttpServlet
{
private static final long serialVersionUID = 1041103360635582685L;
private static Map ok;
static
{
ok = new HashMap();
for (int i = 0; i < 15; i++)
{
String[] ao = new String[3];
ao[0] = "" + i;
ao[1] = i + "部";
ao[2] = "1";
ok.put(new Integer(i), ao);
}
}
public Ts()
{
}
protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException,
IOException
{
req.setCharacterEncoding("utf-8");
String t = "9";
t = req.getParameter("s");
if (t == null)
{
t = "9";
}
String s = req.getParameter("id");
if (t.equals("1"))
{
if (s != null)
{
if (!s.trim().equals(""))
{
String[] mt = (String[]) ok.get(new Integer(Integer.parseInt(s)));
mt[1] = req.getParameter("name");
mt[2] = req.getParameter("status_retrunValue");
}
}
else
{
String[] mt = new String[3];
mt[0] = ok.size() + "";
mt[1] = req.getParameter("name");
mt[2] = req.getParameter("status_retrunValue");
ok.put(new Integer(ok.size()), mt);
}
resp.getWriter().write("{success:true,msg:'成功'}");
}
else if (t.equals("2"))
{
String[] pp = (String[]) ok.get(new Integer(0));
String name = req.getParameter("name");
String stat = req.getParameter("stat");
System.out.println(name + stat);
// ok = new HashMap();
// ok.put(new Integer(0), pp);
serch(req, resp);
}
else if (t.equals("4"))
{
if (!s.trim().equals(""))
{
ok.remove(new Integer(Integer.parseInt(s)));
}
serch(req, resp);
}
else
{
serch(req, resp);
}
}
protected void doPost(HttpServletRequest req, HttpServletResponse resp)
throws ServletException, IOException
{
doGet(req, resp);
}
private void serch(HttpServletRequest req, HttpServletResponse resp) throws IOException
{
int start = Integer.parseInt(req.getParameter("start"));
int limit = Integer.parseInt(req.getParameter("limit"));
String json = "{totalProperty:" + ok.size() + ",root:[";
Collection po = ok.values();
List li = new ArrayList();
for (Iterator iterator = po.iterator(); iterator.hasNext();)
{
li.add(iterator.next());
}
for (int i = start; i < limit + start; i++)
{
if (i == ok.size() - 1)
{
String[] mt = (String[]) li.get(i);
json += "{DIM_NO:" + mt[0] + ",Dim_name:'" + mt[1] + "',status:'" + mt[2]
+ "',oper: ''}";
}
else if (i < ok.size())
{
String[] mt = (String[]) li.get(i);
json += "{DIM_NO:" + mt[0] + ",Dim_name:'" + mt[1] + "',status:'" + mt[2]
+ "',oper: ''}";
if (i != limit + start - 1)
{
json += ",";
}
}
}
json += "]}";
resp.setCharacterEncoding("utf-8");
resp.getWriter().write(json);
}
}
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
ext js2.0 json java web 项目例子 (347个子文件)
Ts.class 4KB
MyEclipseCracker.class 3KB
.classpath 391B
org.eclipse.wst.jsdt.ui.superType.container 49B
ext-all.css 81KB
statusbar.css 1KB
Thumbs.db 8KB
Thumbs.db 8KB
Thumbs.db 8KB
Thumbs.db 7KB
Thumbs.db 7KB
Thumbs.db 7KB
Thumbs.db 7KB
Thumbs.db 7KB
Thumbs.db 7KB
Thumbs.db 6KB
Thumbs.db 6KB
Thumbs.db 6KB
Thumbs.db 6KB
Thumbs.db 6KB
Thumbs.db 6KB
Thumbs.db 6KB
Thumbs.db 6KB
Thumbs.db 6KB
Thumbs.db 5KB
Thumbs.db 5KB
Thumbs.db 5KB
Thumbs.db 5KB
Thumbs.db 3KB
dlg-bg.gif 27KB
tool-sprites.gif 4KB
tip-sprite.gif 4KB
error-tip-corners.gif 4KB
tip-sprite.gif 4KB
tool-sprites.gif 4KB
tip-sprite.gif 4KB
blue-loading.gif 3KB
large-loading.gif 3KB
tab-sprite.gif 3KB
tools-sprites-trans.gif 3KB
tools-sprites-trans.gif 3KB
search-trigger.gif 2KB
tabs-sprite.gif 2KB
loading-balls.gif 2KB
tabs-sprite.gif 2KB
tb-sprite.gif 2KB
checkbox.gif 2KB
clear-trigger.gif 2KB
trigger.gif 2KB
radio.gif 2KB
icon-error.gif 2KB
icon-error.gif 2KB
tab-btm-inactive-right-bg.gif 2KB
tab-btm-right-bg.gif 2KB
icon-question.gif 2KB
icon-question.gif 2KB
date-trigger.gif 2KB
icon-info.gif 2KB
icon-info.gif 2KB
e-handle.gif 2KB
e-handle.gif 2KB
trigger-tpl.gif 1KB
icon-warning.gif 1KB
icon-warning.gif 1KB
gradient-bg.gif 1KB
gradient-bg.gif 1KB
gradient-bg.gif 1KB
gradient-bg.gif 1KB
corners-sprite.gif 1KB
tab-btm-right-bg.gif 1KB
corners-sprite.gif 1KB
tab-btm-right-bg.gif 1KB
tab-btm-inactive-right-bg.gif 1KB
tab-btm-inactive-right-bg.gif 1KB
white-corners-sprite.gif 1KB
white-corners-sprite.gif 1KB
btn-sprite.gif 1KB
s-handle.gif 1KB
s-handle.gif 1KB
scroll-right.gif 1KB
scroll-left.gif 1KB
scroll-right.gif 1KB
scroll-left.gif 1KB
grid3-hd-btn.gif 1KB
btn-sprite.gif 1KB
gradient-bg.gif 1KB
tb-btn-sprite.gif 1KB
tb-btn-sprite.gif 1KB
wait.gif 1KB
scroller-bg.gif 1KB
hd-sprite.gif 1KB
bg.gif 1KB
scroller-bg.gif 1KB
row-check-sprite.gif 1KB
e-handle-dark.gif 1KB
e-handle-dark.gif 1KB
s-handle-dark.gif 1KB
s-handle-dark.gif 1KB
bg-right.gif 1KB
bg-left.gif 1KB
共 347 条
- 1
- 2
- 3
- 4
资源评论
- loveyy19872013-11-14看了,感觉。没啥参考价值 。
- nanPrivate2013-01-10技术有点老了,不过还可以
- happy_0072011-11-02class 配置文件报错,改成下面的以后,好了 <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
jingkuja
- 粉丝: 0
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功