資源簡介
這是一個基于ssh+Ajax的微博發布系統,基本實現了微博的發布,更新,添加好友,關注好友等等!!
代碼片段和文件信息
package?com.action;
import?java.io.IOException;
import?java.io.PrintWriter;
import?java.util.ArrayList;
import?java.util.Date;
import?java.util.List;
import?javax.annotation.Resource;
import?javax.servlet.http.HttpServletRequest;
import?javax.servlet.http.HttpServletResponse;
import?javax.servlet.http.HttpSession;
import?org.apache.struts2.ServletActionContext;
import?org.apache.struts2.interceptor.ServletResponseAware;
import?com.service.MsgInfoService;
import?com.service.MsgMsgRelationService;
import?com.service.UserInfoService;
import?com.service.UserMsgIndexService;
import?com.service.UserService;
import?com.bean.MsgInfo;
import?com.bean.MsgMsgRelation;
import?com.bean.User;
import?com.bean.UserInfo;
import?com.bean.UserMsgIndex;
public?class?MsgInfoAction?implements?ServletResponseAware?{
private?static?final?String?MsgInfo?=?null;
private?javax.servlet.http.HttpServletResponse?response;
@Resource
MsgInfoService?msgInfoService;
@Resource
UserInfoService?userInfoService;
@Resource
UserService?userService;
@Resource
UserMsgIndexService?userMsgIndexService;
@Resource
MsgMsgRelationService?msgMsgRelationService;
MsgInfo?msgInfo;
public?MsgInfo?getMsgInfo()?{
return?msgInfo;
}
public?void?setMsgInfo(MsgInfo?msgInfo)?{
this.msgInfo?=?msgInfo;
}
public?void?setServletResponse(HttpServletResponse?response)?{
this.response?=?response;
}
//?save(add)
public?String?add()?throws?IOException?{
response.setContentType(“text/html;charset=UTF-8“);
response.setCharacterEncoding(“UTF-8“);
HttpServletRequest?request?=?ServletActionContext.getRequest();
HttpSession?session?=?request.getSession();
String?str?=?“addfaile“;
MsgInfo?msgInfo?=?new?MsgInfo();
int?user_id?=?Integer.parseInt(request.getParameter(“user_id“));
System.out.println(“user_id===“?+?user_id);
String?content?=?request.getParameter(“content“);
if?(content.trim()?!=?““)?{
msgInfo.setUser_id(user_id);
msgInfo.setContent(content);
//?下面默認為0
msgInfo.setW_type(0);
msgInfo.setCommented_count(0);
msgInfo.setComment_count(0);
msgInfo.setTransferred_count(0);
msgInfo.setTransfer_count(0);
Date?r_time?=?new?Date();
msgInfo.setR_time(r_time);
msgInfoService.save(msgInfo);
UserMsgIndex?userMsgIndex?=?new?UserMsgIndex();
userMsgIndex.setUser_id(user_id);
userMsgIndex.setAuthor_id(user_id);
userMsgIndex.setMsg_id(msgInfo.getId());
userMsgIndex.setR_time(r_time);
userMsgIndexService.save(userMsgIndex);
UserInfo?userInfo?=?userInfoService.getUserInfoById(msgInfo
.getUser_id());
int?msg_count?=?userInfo.getMsg_count()?+?1;
userInfoService.updateMsgCount(userInfo.getUser_id()?msg_count);
UserInfo?uInfo?=?userInfoService.getUserInfoById(msgInfo
.getUser_id());
session.setAttribute(“userInfoCount“?null);
session.setAttribute(“userInfoCount“?uInfo
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????目錄???????????0??2012-09-25?19:17??微博\
?????目錄???????????0??2012-06-12?09:14??微博\microblog\
?????文件???????11609??2012-09-25?19:15??微博\microblog.sql
?????文件????????6978??2012-09-25?19:14??微博\microblog\.classpath
?????目錄???????????0??2012-06-12?09:14??微博\microblog\.myeclipse\
?????文件?????????300??2012-09-25?19:14??微博\microblog\.myme
?????文件????????1282??2012-09-25?19:14??微博\microblog\.project
?????目錄???????????0??2012-06-12?09:14??微博\microblog\.settings\
?????文件??????????88??2012-09-25?19:14??微博\microblog\.settings\org.eclipse.core.resources.prefs
?????文件?????????629??2012-09-25?19:14??微博\microblog\.settings\org.eclipse.jdt.core.prefs
?????目錄???????????0??2012-06-12?09:14??微博\microblog\src\
?????文件??????????76??2012-09-25?19:15??微博\microblog\src\.struts.mex
?????文件????????3583??2012-09-25?19:15??微博\microblog\src\applicationContext-beans.xm
?????目錄???????????0??2012-09-25?19:15??微博\microblog\src\com\
?????目錄???????????0??2012-06-12?09:14??微博\microblog\src\com\action\
?????文件???????11468??2012-09-25?19:15??微博\microblog\src\com\action\MsgInfoAction.java
?????文件????????5876??2012-09-25?19:15??微博\microblog\src\com\action\UserAction.java
?????文件?????????729??2012-09-25?19:15??微博\microblog\src\com\action\UserInfoAction.java
?????文件????????4311??2012-09-25?19:15??微博\microblog\src\com\action\UserRelationAction.java
?????目錄???????????0??2012-06-12?09:14??微博\microblog\src\com\bean\
?????文件?????????813??2012-09-25?19:15??微博\microblog\src\com\bean\MsgInfo.hbm.xm
?????文件????????1908??2012-09-25?19:15??微博\microblog\src\com\bean\MsgInfo.java
?????文件?????????718??2012-09-25?19:15??微博\microblog\src\com\bean\MsgMsgRelation.hbm.xm
?????文件????????1473??2012-09-25?19:15??微博\microblog\src\com\bean\MsgMsgRelation.java
?????文件?????????692??2012-09-25?19:15??微博\microblog\src\com\bean\User.hbm.xm
?????文件????????1299??2012-09-25?19:15??微博\microblog\src\com\bean\User.java
?????文件?????????581??2012-09-25?19:15??微博\microblog\src\com\bean\UserInfo.hbm.xm
?????文件?????????996??2012-09-25?19:15??微博\microblog\src\com\bean\UserInfo.java
?????文件?????????570??2012-09-25?19:15??微博\microblog\src\com\bean\UserMsgIndex.hbm.xm
?????文件?????????943??2012-09-25?19:15??微博\microblog\src\com\bean\UserMsgIndex.java
?????文件?????????523??2012-09-25?19:15??微博\microblog\src\com\bean\UserRelation.hbm.xm
............此處省略192個文件信息
- 上一篇:Xftp6個人免費版
- 下一篇:Revit二次開發安裝包制作Demo
評論
共有 條評論