昨天碰到一个问题无法解决,知道的话帮一下。谢谢
将这个类暴露给客服端:
public class MessageDwr
{
//该前端处理类所依懒的业务逻辑组件
private MessageService messageService;
public void setMessageService(MessageService messageService)
{
this.messageService = messageService;
}
//创建一条消息
//虽然提供了HttpSession参数,但浏览器javascript调用时无需传入该参数由DWR负责导入
public int createMessage(String title , String content , HttpSession session)throws MessageException
{
Integer userId = (Integer)session.getAttribute("userId");
Message m = new Message();
m.setTitle(title);
m.setContent(content);
return messageService.createMessage(m, userId);
}
//创建一个用户
public int createUser(String user , String pass , HttpSession session)throws MessageException
{
User u = new User();
u.setName(user);
u.setPass(pass);
int userId = messageService.createUser(u);
session.setAttribute("userId", userId);
return userId;
}
//处理用户
public int loginPro(String userName , String pass , HttpSession session)throws MessageException
{
User user = new User();
user.setName(userName);
user.setPass(pass);
int userId = messageService.validateLogin(user);
if(userId>0)
{
session.setAttribute("userId",userId);
}
return userId;
}
//判断当前页面浏览者是否已登录
public int isLogin(HttpSession session)throws MessageException
{
Integer userId = (Integer)session.getAttribute("userId");
if(userId != null && userId>0)
{
return (Integer)userId;
}
return -1;
}
//根据消息Id返回消息
public MessageBean getMessage(int msgId , HttpSession session)throws MessageException
{
return messageService.getMessage(msgId);
}
//返回指定也所显示的全部消息
public List<MessageBean> getAllMessageByPage(int pageNum , HttpSession session)throws MessageException
{
return messageService.getAllMessageByPage(pageNum);
}
}
dwr.xml文件是:
<dwr> <allow> <create creator="spring" javascript="ms"> <param name="beanName" value="messageDwr"/> <include method="createMessage"/> <include method="createUser"/> <include method="loginPro"/> <include method="isLogin"/> <include method="getMessage"/> <include method="getAllMessageByPage"/> </create> <convert match="vo.MessageBean" converter="bean"></convert> <convert match="com.message.exception.MessageException" converter="bean"/> </allow> </dwr>
我已经使用了include为什么还会这样:
怎么会有Object类里的方法,不是已经使用的include了吗,怎么回事,?