不可能看不到!
那是个采用mvc结构(no struts)的bbs,采用xml+xsl方式显示,类似delphibbs.
下一步将采用JSTL,action 只产生xml data,xml和xsl的结合放到jsp里。
这是home代码。
----------------------
public class Home implements Action {
public ActionForward excute(HttpServletRequest request, HttpServletResponse response)
throws IOException, ServletException ,ActionException{
HomeDAO homeDAO=new HomeDAO();
String xmlString=homeDAO.getXML();
PrintWriter out = response.getWriter();
out.println(xmlString);
out.flush();
out.close();
return null;
}
}
----------------------
public class HomeDAO {
private DBConnectionManager dbcm = DBConnectionManager.getInstance();
public String getXML()throws ActionException{
Connection connection=null;
try {
XMLData xmlData=new XMLData("home.xsl");
xmlData.append("<home>/n");
xmlData.append("<forums>/n");
connection=dbcm.getConnection();
DBAccess dba=new DBAccess(connection);
String sql="SELECT f_id,f_name,f_u_id,u_name,f_info FROM forum,user WHERE forum.f_u_id=user.u_id";
ResultSet rs=dba.openSelect(sql);
while(rs.next()){
xmlData.append("<forum>/n");
xmlData.append("<f_id>");
xmlData.append(rs.getString(1));
xmlData.append("</f_id>/n");
xmlData.append("<f_name>");
xmlData.append(rs.getString(2));
xmlData.append("</f_name>/n");
xmlData.append("<f_u_id>");
xmlData.append(rs.getString(3));
xmlData.append("</f_u_id>/n");
xmlData.append("<f_u_name>");
xmlData.append(rs.getString(4));
xmlData.append("</f_u_name>/n");
xmlData.append("<f_info>");
xmlData.append(rs.getString(5));
xmlData.append("</f_info>/n");
xmlData.append("</forum>/n");
}
rs.close();
dba.closeSelect();
xmlData.append("</forums>/n");
xmlData.append("</home>/n");
return xmlData.toString();
} catch (SQLException ex) {
//
throw new ActionException("db_error!");
}finally{
try {
dbcm.freeConnection(connection);
} catch (SQLException ex) {
//
}
}
}
}