首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > JAVA > Java Web开发 >

论坛无法回复不显示异常

2013-09-24 
论坛无法回复不显示错误论坛系统无法回复,可以连接数据库,在数据库里直接插入回复帖子可以显示,在网页里提

论坛无法回复不显示错误

论坛系统无法回复,可以连接数据库,在数据库里直接插入回复帖子可以显示,在网页里提交回复之后,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>          


          <tr>
              <td width="27%" bgcolor="#F9F9F9" align="center" valign="top">
                  <table border="0" width="90%" height="100%">
                      <tr height="30%">
                          <td valign="top">
                              <table border="0" style="margin-top:10">
                                  <tr>
                          <td><html:errors property="bbsAnswerTitle"/></td>
                      </tr>
                      <tr>
                          <td><html:errors property="bbsAnswerContent"/></td>
                      </tr>
                              </table>
                          </td>
                      </tr>
                      <tr>
                        <td valign="top">
                            <table border="0" width="90%" style="margin-top:10">


                                <tr><td>发帖许可</td></tr>
                            </table>
                        </td>
                      </tr>
                  </table>
              </td>
              <td>
                  <table border="1" width="100%" cellspacing="0" cellpadding="0" bordercolor="#E3E3E3" bordercolorlight="#E3E3E3" bordercolordark="white" rules="rows">
                      <tr height="30">
                          <td width="15%" align="center">【主题】</td>
                          <td align="center"><html:text property="bbsAnswerTitle" size="77" maxlength="35"/></td>
                      </tr>
                      <tr bgcolor="#F9F9F9">
                          <td align="center">【表情】</td>
                          <td><%@ include file="/pages/add/face.jsp" %></td>
                      </tr>
                      <tr height="30">


                          <td align="center">【内容】</td>
                          <td align="center"><%@ include file="/pages/add/font.jsp"%></td>
                      </tr>
                      <tr height="30" bgcolor="#F9F9F9">
                          <td colspan="2" align="right"><%@ include file="/pages/add/count.jsp" %></td>
                      </tr>
                      <tr><td colspan="2" align="center"><html:textarea property="bbsAnswerContent" rows="15" cols="79" styleId="content" onkeydown="check(content,ContentUse,ContentRem,1000)" onkeyup="check(content,ContentUse,ContentRem,1000)" onchange="check(content,ContentUse,ContentRem,1000)"/></td></tr>
                      <tr height="30" align="center">
                          <td colspan="2">
                              <html:submit value="回复帖子"/>
                              <html:reset value="重新填写"/>
                          </td>
                      </tr>
                  </table>
              </td>


          </tr>
      </html:form>
      </table>
    </center>
  </body>
</html>

热点排行