导航:首页 > 编程语言 > java站内信

java站内信

发布时间:2022-07-03 17:11:04

java开发站内信问题 求一个很不错的思路

B/S架构的除了你去向服务器发送请求,目前还没有发现你的服务器可以向客户端推送的技术.

② 帮我把下面Java写的站内信的代码,转化成c#的,,高手来帮帮我

using System;
//using UserPackage

public class Message {

public static const string STATUS_NEW = "NEW";
public static const string STATUS_READED = "READED";
public static const string STATUS_DELETED = "DELETED";
public static const string STATUS_SENDED = "SENDED";
public static const string STATUS_DELETE_FOREVER = "DELETE_FOREVER";

/**
* @hibernate.id
* generator-class="native"
*/
private int id;
/**
* @hibernate.property
*/
private string title;
/**
* @hibernate.property
*/
private string content;
/**
* @hibernate.property
*/
private string sendStatus;
/**
* @hibernate.property
*/
private string receiveStatus;
/**
* update="false"表示此字段不更新
* @hibernate.property update="false"
*/
private DateTime createTime;
/**消息发送方
* @hibernate.many-to-one
*/
private User sender;
/**消息接收方
* @hibernate.many-to-one
*/
private User receiver;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public string getTitle() {
return title;
}
public void setTitle(string title) {
this.title = title;
}
public string getContent() {
return content;
}
public void setContent(string content) {
this.content = content;
}
public User getSender() {
return sender;
}
public void setSender(User sender) {
this.sender = sender;
}
public User getReceiver() {
return receiver;
}
public void setReceiver(User receiver) {
this.receiver = receiver;
}
public string getSendStatus() {
return sendStatus;
}
public void setSendStatus(string sendStatus) {
this.sendStatus = sendStatus;
}
public string getReceiveStatus() {
return receiveStatus;
}
public void setReceiveStatus(string receiveStatus) {
this.receiveStatus = receiveStatus;
}
public DateTime getCreateTime() {
return createTime;
}
public void setCreateTime(DateTime createTime) {
this.createTime = createTime;
}
}
注意第二行

③ java页面回显错误信息。

页面
<td height="30" class="red"><html:errors property="errors.notlogin" bundle="MessageResources" /></td>
改为:
页面
<td height="30" class="red"><html:errors property="notlogin" bundle="MessageResources" /></td>
property="notlogin"是你的error key,ActionMessage("errors.notlogin")中才是你配置文件的信息

④ java站内信接口调用文档怎么使用

1、调用WebService,对方给出WebService地址,可以用Axis生成对WebService的调用代码进行调用 2、对方提供接口文档和传输方式,根据接口文档调用。 Java接口是一系列方法的声明,是一些方法特征的集合,一个接口只有方法的特征没有方法的实现,...

⑤ java 聊天

对楼主的回帖:
1. java.lang.NullPointerException 空指针异常。看看取值或jsp跳转是否正确,一般情况之下是由于编程人员的不仔细造成的。
2. 检查连接数据库相关的代码里连接字符
3. 字符串变量未初始化;
4. 接口类型的对象没有用具体的类初始化
5. 当一个对象的值为空时。

====
但是在你这个问题看来不纯是一个简单的空指针了
你有可能错误在:
1.看看有没有包,在linux下客户端的测试之下要把项目相对应的包拷贝到linux下。
2.我有JAVA版的聊天室项目,你可以与我取得联系:[email protected]
注明一下我会查收邮件传给你。

⑥ 几道JAVA读程序题,请高手帮忙看下,最好能稍稍解释下62643

4题答案:a= 1;b= 2
5题答案:11 0 1
6题答案:12
7题答案:012

不明白答案为什么是这样,站内信问我,这里写太麻烦了

⑦ 谁有论坛上站内信实现jsp structs2源码

import java.io.*;
import java.util.List;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.struts2.ServletActionContext;

import com.credit.proj.entity.FileForm;
import com.credit.proj.entity.Message;
import com.credit.proj.entity.VMessage;
import com.credit.publicmodel.commons.BaseAction;
import com.credit.publicmodel.commons.Constants;
import com.credit.publicmodel.message.service.MessageService;
import com.credit.publicmodel.permission.security.userDetails.UserInfo;
import com.credit.publicmodel.util.DateUtil;
import com.credit.publicmodel.util.FileUtil;
import com.credit.publicmodel.util.JsonUtil;

/**
* @funciton 消息处理
*
* @author credit004
*
*/
public class MessageAction extends BaseAction implements Constants{
private static final long serialVersionUID = 1L;

private final Log log = LogFactory.getLog(getClass());

private int start;
private int limit;
private MessageService messageService;

// private int msgType;
private String sendToId;
private String piKey;
private String title;
private String content;

private int id;
private int isRead;
// private int processType = 0;
private int msgType;

private String title_S = "";
private int msgType_S = 0;
private String title_SS = "";
private int msgType_SS = 0;

/*文件上传*/
private File fileUpload;//上传文件 如若要设置原型的话,请注意
private String fileName;//上传的名字 如若要设置原型的话,请注意
private String contentType;//上传的类型 如若要设置原型的话,请注意

private int global_msgId;//附件下载(列表)

private int downId;//下载附件

private int del_msgId;//删除文件,设置message表 标识

FileForm ff = null;

/**所有新消息*/
public void getAllNewMessage() throws Exception{
UserInfo ui = (UserInfo)this.getSession().getAttribute("userDetails");

String userId = "%,"+String.valueOf(ui.getId())+",%";

int totalNumber = messageService.getReadMessageAmount(userId, 0);

List<VMessage> list = messageService.getUserReadMessageForPages(userId, start, limit,0);

JsonUtil.jsonFromList(list,totalNumber);
}

/**轮询*/
public int countMessage(){

UserInfo userInfo = (UserInfo)this.getSession().getAttribute("userDetails");

String userId = "%,"+String.valueOf(userInfo.getId())+",%";

int count = messageService.getReadMessageAmount(userId,0);

return count;

}

/**发送消息 jiang*/
public String sendMessage() throws Exception{

Message msg = new Message();
FileForm ff = new FileForm();

UserInfo userInfo = (UserInfo)this.getSession().getAttribute("userDetails");

//上传文件存储的名字
String storeFileName = "";
//上传路径
String path = "";
// judge
boolean isUploadOk = false;

String sendToId = ","+this.sendToId+",";

/*消息*/
msg.setPiKey(piKey);
msg.setType(msgType);
msg.setTitle(title);
msg.setContent(content);
msg.setCreateTime(DateUtil.getNowDateTime());
msg.setSendTime(DateUtil.getNowDateTime("yyyy-MM-dd (E) HH:mm"));
msg.setSendFrom(userInfo.getId());
msg.setProcessType(Constants.PROCESS_TYPE_BG);
msg.setTakePeople(sendToId);

/*文件上传 上传了文件*/
if(fileUpload != null){
storeFileName = "msg"+DateUtil.getNowDateTime("yyyyMMddHHmmssSSS")+FileUtil.getExtention(fileName);
path = "/upload/"+userInfo.getUsername()+"/msg/appendix/"+storeFileName;
String realPath = ServletActionContext.getServletContext()
.getRealPath(path);

File storeFile = new File(realPath);

System.out.println("文件长度="+fileUpload.length());

ff.setContentType(contentType);
ff.setIsDel(0);
ff.setSize(fileUpload.length());
ff.setName(fileName);
ff.setPath(path);
ff.setSendToId(sendToId);
ff.setTitle(userInfo.getName()+" 提供的附件");
ff.setType(1);//1 代表消息上传附件 待议
ff.setUploaderId(userInfo.getId());
ff.setUpTime(DateUtil.getNowDateTime());

isUploadOk = FileUtil.fileUpload(fileUpload, storeFile, this.BUFFER_SIZE_MSG);

msg.setHasAppendix(1);//设置有附件

if(!isUploadOk){
ff = null;
}
}else{
ff = null;//没上传文件
}

messageService.sendMessage(msg,ff);

return null;

}
/**删除消息 jiang*/
public void delMessage() throws Exception{
messageService.delMessage(id);
id = 0;//使用完后---初始化
}

/**得到详细信息 jiang*/
public void getDetailMessage() throws Exception{
messageService.getDetailMessage(id);
messageService.readMessage(id, 1);//设置已读
id = 0;//使用完后--初始化
}

/**设置已读 作废 jiang*/
public void readMessage() throws Exception{
log.info("isRead=="+isRead);
}

/**已读通知 已作废 jiang*/
public void getReadMesage() throws Exception{
UserInfo ui = (UserInfo)this.getSession().getAttribute("userDetails");

String userId = "%,"+String.valueOf(ui.getId())+",%";

int totalNumber = messageService.getReadMessageAmount(userId,1);

List<VMessage> list = messageService.getUserReadMessageForPages(userId, start, limit,1);

JsonUtil.jsonFromList(list,totalNumber);
}

/**收消息盒子*/
public void getMessageBox() throws Exception{
UserInfo ui = (UserInfo)this.getSession().getAttribute("userDetails");

String userId = "%,"+String.valueOf(ui.getId())+",%";
int isDel = 0;

List<VMessage> list = null;
int totalNumber = 0;

// System.out.println("show me the state"+isRead+processType+msgType);

if(title_S.equals("") && msgType_S == 0){
totalNumber = messageService.getAllMessageAmout(userId, isDel);

list = messageService.getUserMessageForPages(userId, isDel, start, limit);
}else{

String title_S = "%"+this.title_S+"%";

Object[] params = {userId,title_S,this.title_S,msgType_S,msgType_S,};

totalNumber = messageService.getSearchMessageAmount(params);
list = messageService.getUserSearchMessageForPages(params, start, limit);

}

JsonUtil.jsonFromList(list,totalNumber);

}

/**发消息盒子 jiang*/
public void sendMessageBox() throws Exception{
UserInfo ui = (UserInfo)this.getSession().getAttribute("userDetails");

String title_SS = "%"+this.title_SS+"%";

Object[] params = {ui.getId(),title_SS,this.title_SS,msgType_SS,msgType_SS};

//here codes
int totalNumber = messageService.getUserSendMessageAmount(params);
List<VMessage> list = messageService.getUserSendMessageForPages(params, start, limit);

JsonUtil.jsonFromList(list,totalNumber);
}

/*********************************************************************/
/** ################# 附件下载 ##################### **/
/*********************************************************************/

/**附件下载列表*/
public void showDownload() throws Exception{

int isDel = 0;

System.out.println("global_msgId="+global_msgId);

int totalNumber = messageService.getDownloadAmount(global_msgId, isDel);

List<FileForm> list = messageService.getDownload(global_msgId, isDel, start, limit);

JsonUtil.jsonFromList(list,totalNumber);
}

/*********************************************************************/
/**下载--获得输入流*/
public InputStream getMsgDownload(){

// FileForm ff = messageService.getFile(downId);

String path = ff.getPath();

System.out.println("ff=="+ff.getPath());

return ServletActionContext.getServletContext().getResourceAsStream(path);
}

/**下载--默认*/
public String msgDownload(){

ff = messageService.getFile(downId);

return "success";
}

/**下载--向struts.xml内传值 jiang*/
public String getDownloadFileName(){
// FileForm ff = messageService.getFile(downId);

String fileName = ff.getName();

try {
fileName = new String(fileName.getBytes(),"ISO8859-1");
if(ff != null){
return fileName;
}else{
return "";
}

} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}

return "error";

}
/*********************************************************************/

/**删除 下载文件---只是在数据库标识已删除 jiang*/
public void delMsgDownload() {
String jsonStr = "";
try {
messageService.delFile(downId,del_msgId);
jsonStr = "{success:true}";
JsonUtil.writeJsonString(jsonStr);

} catch (Exception e) {
jsonStr = "{success:false}";
e.printStackTrace();
}finally{
JsonUtil.writeJsonStringNoException(jsonStr);
}
}

/*****回收站*******/
public void delectedMessage() throws Exception{
UserInfo ui = (UserInfo)this.getSession().getAttribute("userDetails");

String userId = "%,"+String.valueOf(ui.getId())+",%";

int totalNumber = messageService.getAllMessageAmout(userId, 1);

List<VMessage> list = messageService.getUserMessageForPages(userId, 1, start, limit);

JsonUtil.jsonFromList(list,totalNumber);
}

/**从数据库中删除消息*/
public void removeMessage(){
String jstonStr = "{success:false}";

try {
messageService.removeMessage(id);

jstonStr = "{success:true}";
} catch (Exception e) {
jstonStr = "{success:false}";
e.printStackTrace();
}
JsonUtil.writeJsonStringNoException(jstonStr);
}

/*############################ getter and setters ##########################*/

⑧ 【站内信】user表和message表如何联立起来怎样建表好

这样的需求应该做中间表 用户表 用户消息关联表 消息表
其中用户消息关联表 有字段 uid mid
不明白继续提问!

阅读全文

与java站内信相关的资料

热点内容
三台服务器配置IP地址 浏览:171
如何用命令方块连续对话 浏览:274
win7linux共享文件夹 浏览:301
命令符打开本地服务 浏览:597
android应用程序源码 浏览:699
安卓开发工程师简历怎么写 浏览:57
热水器水量服务器是什么意思 浏览:115
stk卫星编译 浏览:477
对后台程序员的要求 浏览:758
ios大文件夹图标 浏览:624
生的计划pdf 浏览:711
oppoa93加密便签在哪查找 浏览:19
两个数字的加减乘除运算编程 浏览:227
给手机加密码忘记了怎么办 浏览:601
单片机运算符 浏览:297
移动端微信商城源码 浏览:443
编程猫下一个背景在哪里 浏览:358
javaclasstype 浏览:239
乐高编程和乐高课的延伸 浏览:357
苹果手机怎么切换app美国账号 浏览:865