日期:2014-05-17  浏览次数:20706 次

论坛无法回复不显示错误

论坛系统无法回复,可以连接数据库,在数据库里直接插入回复帖子可以显示,在网页里提交回复之后,ECLIPSE不显示错误,只是跳到跟帖首部  以下是代码


BbsAction.java

/** 回复帖子 */
public ActionForward answerBbs(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response){
HttpSession session=request.getSession();
BbsAnswerForm bbsAnswerForm=(BbsAnswerForm)form;

String  rootId=(String)session.getAttribute("bbsId");
String  bbsTitle=Change.HTMLChange(bbsAnswerForm.getBbsAnswerTitle());
String  bbsContent=Change.HTMLChange(bbsAnswerForm.getBbsAnswerContent());
String  bbsSender=((UserForm)session.getAttribute("logoner")).getUserName();
String  bbsSendTime=Change.dateTimeChange(new Date());
String  bbsFace=bbsAnswerForm.getBbsFace();

String sql="insert into tb_bbsAnswer(bbsAnswer_rootID,bbsAnswer_title,bbsAnswer_content,bbsAnswer_sender,bbsAnswer_sendTime,bbsAnswer_face) values(?,?,?,?,?,?)";
Object[] params=new Object[6];


params[0]=rootId;
params[1]=bbsTitle;
params[2]=bbsContent;
params[3]=bbsSender;
params[4]=bbsSendTime;
params[5]=bbsFace;

ActionMessages messages=new ActionMessages();
String forwardPath="";

OpDB myOp=new OpDB();
int i=myOp.OpUpdate(sql, params);
if(i<=0){
System.out.println("回复帖子失败!");
forwardPath="error";
messages.add("userOpR",new ActionMessage("luntan.bbs.answerR.E"));
}
else{
System.out.println("回复帖子成功!");
forwardPath="success";
messages.add("userOpR",new ActionMessage("luntan.bbs.answerR.S"));
bbsAnswerForm.clear();
}
saveErrors(request,messages);
return mapping.findForward(forwardPath);
}


下面是JSP文件

      <!-- ****************回复帖子**************** -->
      <html:link linkName="answer"/>
      <table border="1" width="99%" cellspacing="0" cellpadding="0" bordercolor="#E3E3E3" bordercolorlight="#E3E3E3" bordercolordark="white" rules="all">
      <html:form action="needLogin/answerBbs.do">
          <input type="hidden" name="method" value="answerBbs">
  <tr bgcolor="#F0F0F0" height="30"><td colspan="2" style="text-indent:5" background="images/index/classT.jpg"><b><font color="white"> 回复【<bean:write name="bbsRootSingle" property="bbsTitle" filter="false"/>】帖子</font></b></td></tr>