BbsAction.java里面就提示Cannot make a static reference to the non-static method setBbsId(String) from the type BbsForm
OpDB.java里面是这个啊,没错
public BbsForm OpBbsSingleShow(String sql,Object[] params){
BbsForm bbsform=null;
DB mydb=new DB();
mydb.doPstm(sql,params);
ResultSet rs=mydb.getRs();
try {
if(rs!=null&&rs.next()){
bbsform=new BbsForm();
bbsform.setBbsId(String.valueOf(rs.getInt(1)));
bbsform.setBbsBoardID(String.valueOf(rs.getInt(2)));
bbsform.setBbsTitle(rs.getString(3));
bbsform.setBbsContent(rs.getString(4));
bbsform.setBbsSender(rs.getString(5));
bbsform.setBbsSendTime(Change.dateTimeChange(rs.getTimestamp(6)));
bbsform.setBbsFace(rs.getString(7));
bbsform.setBbsOpTime(Change.dateTimeChange(rs.getTimestamp(8)));
bbsform.setBbsIsTop(rs.getString(9));
bbsform.setBbsToTopTime(Change.dateTimeChange(rs.getTimestamp(10)));
bbsform.setBbsIsGood(rs.getString(11));
bbsform.setBbsToGoodTime(Change.dateTimeChange(rs.getTimestamp(12)));
}
} catch (SQLException e) {
System.out.println("调用OpDB类中OpBbsingleShow()方法出错!");
e.printStackTrace();
}
return bbsform;
}
struts-config.xml里面配置:
<!-- 修改帖子 -->
<action
path="/needLogin/modBbs"
type="com.yxq.action.BbsAction"
parameter="method"
name="bbsForm"
scope="request"
validate="true"
input="/view/indexTemp.jsp">
<forward name="showModJSP" path="/view/indexTemp.jsp"/>
<forward name="success" path="/user/listShow.do?method=rootListShow"/>
<forward name="error" path="/view/indexTemp.jsp"/>
</action>