package com.student.data.action;
import java.io.IOException;
import java.io.PrintWriter;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
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;
import net.sf.json.JSONObject;
import com.student.data.dao.CommunityDao;
public class CommunityAction extends HttpServlet {
private CommunityDao communityDao;
public CommunityAction() {
super();
}
public void destroy() {
super.destroy();
}
public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
doPost(request, response);
}
public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String path = request.getContextPath();
response.setContentType("text/html;charset=utf-8");
request.setCharacterEncoding("utf-8");
response.setCharacterEncoding("utf-8");
PrintWriter out = response.getWriter();
String action_flag = request.getParameter("action_flag");
if (action_flag.equals("addMessage")) {
addMessage(request, response);
} else if (action_flag.equals("listMessage")) {
listMessage(request, response);
} else if (action_flag.equals("listMessageChoice")) {
listMessageChoice(request, response);
} else if (action_flag.equals("deleteCategory")) {
deleteCategory(request, response);
} else if (action_flag.equals("listMessageUser")) {
listMessageUser(request, response);
} else if (action_flag.equals("addCategory")) {
addCategory(request, response);
} else if (action_flag.equals("listMessageCategory")) {
listMessageCategory(request, response);
}else if (action_flag.equals("listMessageCategoryPhone")) {
listMessageCategoryPhone(request, response);
}else if (action_flag.equals("addCategoryPhone")) {
addCategoryPhone(request, response);
} else if (action_flag.equals("listMessageCategoryNotice")) {
listMessageCategoryNotice(request, response);
} else if (action_flag.equals("addCollect")) {
addCollect(request, response);
}else if (action_flag.equals("deleteCollect")) {
deleteCollect(request, response);
} else if (action_flag.equals("listMessageMyCollect")) {
listMessageMyCollect(request, response);
} else if (action_flag.equals("listMessageCategoryMyNotice")) {
listMessageCategoryMyNotice(request, response);
}else if (action_flag.equals("listMessageCategoryMyCommuity")) {
listMessageCategoryMyCommuity(request, response);
}else if (action_flag.equals("updateCommunity")) {
updateCommunity(request, response);
}else if (action_flag.equals("listSearchCommunity")) {
listSearchCommunity(request, response);
}else if (action_flag.equals("addCommunityCategory")) {
addCommunityCategory(request, response);
}else if (action_flag.equals("listMessageCategoryCm")) {
listMessageCategoryCm(request, response);
}else if (action_flag.equals("deleteCategoryCommunity")) {
deleteCategoryCommunity(request, response);
}else if (action_flag.equals("listMessageCategoryCommPhone")) {
listMessageCategoryCommPhone(request, response);
}else if (action_flag.equals("listMessageQueryCommunity")) {
listMessageQueryCommunity(request, response);
}
}
public void init() throws ServletException {
communityDao = new CommunityDao();
}
private void listSearchCommunity(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String path = request.getContextPath();
String cName = request.getParameter("cName");
String userId = request.getParameter("userId");
List<Map<String, Object>> list = communityDao.listSearchCommunity(cName,userId);
JSONObject jsonmsg = new JSONObject();
jsonmsg.put("repMsg", "请求成功");
jsonmsg.put("repCode", "666");
jsonmsg.put("data", list);
System.out.println(jsonmsg);
response.getWriter().print(jsonmsg);// 将路径返回给客户端
}
private void updateCommunity(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String path = request.getContextPath();
String cUserName = request.getParameter("cUserName");
String cMessage = request.getParameter("cMessage");
String cId = request.getParameter("cId");
List<Object> params = new ArrayList<Object>();
params.add(cUserName);
params.add(cMessage);
params.add(cId);
boolean flag = communityDao.updateCommunity(params);
if (flag) {
JSONObject jsonmsg = new JSONObject();
jsonmsg.put("repMsg", "更新成功");
jsonmsg.put("repCode", "666");
System.out.println(jsonmsg);
response.getWriter().print(jsonmsg);// 将路径返回给客户端
} else {
JSONObject jsonmsg = new JSONObject();
jsonmsg.put("repMsg", "更新失败");
jsonmsg.put("repCode", "111");
System.out.println(jsonmsg);
response.getWriter().print(jsonmsg);// 将路径返回给客户端
}
}
private void deleteCollect(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String path = request.getContextPath();
String cCategoryId = request.getParameter("cCategoryId");
String cUserId = request.getParameter("cUserId");
System.out.println(cCategoryId);
List<Object> params = new ArrayList<Object>();
params.add(cCategoryId+"");
params.add(cUserId+"");
boolean flag = communityDao.deleteCollect(params);
if (flag) {
JSONObject jsonmsg = new JSONObject();
jsonmsg.put("repMsg", "收藏取消成功");
jsonmsg.put("repCode", "666");
System.out.println(jsonmsg);
response.getWriter().print(jsonmsg);// 将路径返回给客户端
} else {
JSONObject jsonmsg = new JSONObject();
jsonmsg.put("repMsg", "收藏取消失败");
jsonmsg.put("repCode", "666");
System.out.println(jsonmsg);
response.getWriter().print(jsonmsg);// 将路径返回给客户端
}
}
private void addCollect(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String path = request.getContextPath();
String cUserId = request.getParameter("cUserId");
String cUserName = request.getParameter("cUserName");
String cCategoryId = request.getParameter("cCategoryId");
String cCategoryName = request.getParameter("cCategoryName");
List<Object> params = new ArrayList<Object>();
params.add(cUserId);
params.add(cUserName);
params.add(cCategoryId);
params.add(cCategoryName);
boolean flag = communityDao.addCollect(params);
if (flag) {
JSONObject jsonmsg = new JSONObject();
jsonmsg.put("repMsg", "收藏成功");
jsonmsg.put("repCode", "666");
System.out.println(jsonmsg);
response.getWriter().print(jsonmsg);// 将路径返回给客户端
// response.sendRedirect(path + "/servlet/NoticeAction?action_flag=listMessage");
} else {
JSONObject jsonmsg = new JSONObject();
jsonmsg.put("repMsg", "收藏失败");
jsonmsg.put("repCode", "111");
System.out.println(jsonmsg);
// response.getWriter().print(jsonmsg);// 将路径返回给客户端
}
}
private void listMessageCategory(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
String path = request.getContextPath();
// 已经进行分页之后的数据集合
List<Map<String, Object>> list_tea = communityDao.listMessageCategoryPc();
request.setAttribute("listMessage", list_tea);
request.getRequestDispatcher("../categoryMessage.jsp").forward(request, response);
}
private void listMessageCategoryCm(HttpServletRequest request, HttpServletResponse response) throws S
没有合适的资源?快使用搜索试试~ 我知道了~
温馨提示
客户端: 1:注册登录:通过手机号码和密码完成注册和登录; 2:发布社团:发布社团信息; 3:查看社团:用户可以查看发布的社团信息; 4:加入社团:对自己感兴趣的社团可以加入; 5:收藏社团:可以收藏社团 6:社团讨论:可以在社团发布意见信息 6:个人信息:查看自己的个人信息以及对密码进行修改,查看收藏信息 后台管理员: 1:用户信息:可以查看注册的用户信息 2:社团信息:查看用户发布的社团信息 3:社团分类:添加和查看分类信息 ———————————————— 版权声明:本文为CSDN博主「Android毕业设计源码」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。 原文链接:https://blog.csdn.net/u014388322/article/details/128138590
资源推荐
资源详情
资源评论
收起资源包目录
基于Android的校园社团管理(Android studio毕业设计,Android课程设计) (322个子文件)
CommunityAction.class 16KB
CommunityDao.class 15KB
Demo.class 10KB
RegisterAction.class 8KB
FileImageUploadServlet.class 6KB
RegisterDao.class 6KB
JpushAction.class 6KB
JdbcUtils.class 5KB
ReviewAction.class 5KB
MembersAction.class 5KB
DeviceExample.class 4KB
ReviewDao.class 4KB
MembersDao.class 3KB
TypeDao.class 3KB
GsonTools.class 3KB
JpushDao.class 2KB
ImageUploadDao.class 2KB
CommunityTest.class 1KB
ScoreTest.class 1KB
StringUtil.class 992B
RegisterService.class 778B
GsonTools$2.class 600B
ReviewService.class 582B
NoticeService.class 582B
GsonTools$1.class 563B
Consts.class 536B
CommunityService.class 407B
MembersService.class 398B
JpushService.class 392B
ImageUploadService.class 248B
.classpath 1KB
org.eclipse.wst.common.component 582B
org.eclipse.wst.jsdt.ui.superType.container 49B
style.css 20KB
tinymce.css 9KB
default.css 9KB
select.css 2KB
editor.css 605B
tinymce.gif 12KB
default.gif 7KB
etc_24.gif 1KB
etc_33.gif 1KB
etc_32.gif 1KB
etc_36.gif 1KB
etc_31.gif 1KB
etc_30.gif 1KB
etc_25.gif 1KB
etc_26.gif 1012B
etc_34.gif 992B
etc_35.gif 989B
etc_27.gif 978B
etc_02.gif 687B
etc_12.gif 687B
etc_16.gif 685B
etc_15.gif 683B
etc_03.gif 682B
etc_08.gif 680B
etc_01.gif 671B
etc_09.gif 670B
etc_13.gif 666B
etc_06.gif 660B
etc_14.gif 657B
etc_07.gif 657B
etc_10.gif 657B
etc_04.gif 655B
etc_11.gif 655B
etc_05.gif 643B
etc_22.gif 473B
etc_18.gif 453B
etc_20.gif 453B
etc_17.gif 445B
etc_23.gif 444B
etc_19.gif 423B
topbg.gif 415B
etc_29.gif 342B
etc_21.gif 322B
etc_28.gif 303B
lefttop.gif 204B
tcbg.gif 203B
toolbg.gif 133B
righttop.gif 82B
inputbg.gif 82B
leftmenubg.gif 76B
th.gif 76B
list.gif 70B
pre.gif 70B
list1.gif 70B
next.gif 70B
div.gif 64B
px.gif 61B
ul.gif 60B
ol.gif 60B
dl.gif 59B
rlist.gif 56B
p.gif 54B
line.gif 51B
leftline.gif 50B
PIE.htc 40KB
image.html 3KB
remote_image.html 2KB
共 322 条
- 1
- 2
- 3
- 4
资源评论
Android毕业设计源码
- 粉丝: 1w+
- 资源: 273
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功