⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 boardssavetag.java

📁 天乙社区6.0是一套基于JAVA技术的网络虚拟社区
💻 JAVA
字号:
package com.laoer.bbscs.web.tag;

import javax.servlet.jsp.tagext.TagSupport;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.*;
import javax.servlet.http.*;
import com.laoer.bbscs.business.*;
import com.laoer.bbscs.business.service.*;
import com.laoer.bbscs.bean.*;
import com.laoer.bbscs.sys.*;
import com.laoer.bbscs.web.servlet.*;
import java.util.*;
import org.apache.struts.config.ModuleConfig;
import java.io.*;

/**
 * <p>Title: TianYi BBS</p>
 * <p>Description: TianYi BBS System</p>
 * <p>Copyright: Copyright (c) 2004</p>
 * <p>Company: LAOER.COM/TIANYISOFT.NET</p>
 * @author laoer
 * @version 6.0
 */

public class BoardsSaveTag
    extends TagSupport {

  private String userCheck;
  private String userInfo;
  private String type;

  public BoardsSaveTag() {
  }

  public String getUserCheck() {
    return userCheck;
  }

  public void setUserCheck(String userCheck) {
    this.userCheck = userCheck;
  }

  public String getUserInfo() {
    return userInfo;
  }

  public void setUserInfo(String userInfo) {
    this.userInfo = userInfo;
  }

  public int doStartTag() throws JspException {
    return (SKIP_BODY);
  }

  public int doEndTag() throws JspException {
    ModuleConfig config =
        (ModuleConfig) pageContext.getServletContext().getAttribute(
            org.apache.struts.Globals.MODULE_KEY);
    JspWriter writer = pageContext.getOut();
    /*
         WebApplicationContext wac = WebApplicationContextUtils.
        getRequiredWebApplicationContext(pageContext.getServletContext());*/

    HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
    HttpServletResponse response = (HttpServletResponse) pageContext.
        getResponse();

    UserCheck uc = (UserCheck) request.getAttribute(userCheck);
    if (uc == null) {
      uc = new UserCheck(request, response);
      //uc = new UserCheck(request, response, wac);
    }
    UserInfo ui = (UserInfo) request.getAttribute(userInfo);
    String userSave = "";
    if (ui != null) {
      userSave = ui.getBoardSave();
    }
    //BoardList boardList = (BoardList) wac.getBean("boradList");
    //IBoardsService ibs = (IBoardsService) wac.getBean("boardsService");
    BoardList boardList = (BoardList) AppContext.getInstance().getAppContext().
        getBean("boradList");
    IBoardsService ibs = (IBoardsService) AppContext.getInstance().
        getAppContext().getBean("boardsService");
    Board b = null;
    Map map = null;
    Boards bs = null;
    List bslist = null;
    try {
      for (int i = 0; i < boardList.getBoradList().size(); i++) {
        b = (Board) boardList.getBoradList().get(i);
        writer.println(
            "<table width=93% border=0 align=center cellpadding=0 cellspacing=0>");
        writer.println("<tr>");
        writer.print(
            "<td class='S4' height=20>&nbsp;<b><span class='bt FONT1'>");
        writer.print(b.getBoardName() + "(" + b.getEboardName() +
                     ")</span></b>\n");
        writer.println("</td>");
        writer.println("</tr>");
        writer.println("<tr>");
        writer.println("<td class='S1'>");
        map = b.getBoards();
        bslist = ibs.getMap2Lsit(map, uc);
        writer.println(
            "<table width=100% border=0 cellpadding=3 cellspacing=1>");
        int counter = 0;
        for (int j = 0; j < bslist.size(); j++) {
          bs = (Boards) bslist.get(j);
          if (counter == 0) {
            counter = 4;
            writer.print("<tr class='S3'>");
          }
          writer.println("<td width=25%>");
          writer.println("<div align=center>");
          if (type.equals("boardssave")) {
            writer.println("<input type='checkbox' name='zc' value='" +
                           bs.getId().longValue() + "' " +
                           SysUtil.
                           getBoardsSaveChecked(userSave, bs.getId().longValue()) +
                           ">" + bs.getBoardsName());
          }
          else if (type.equals("list")) {
            writer.println("<a href='forum" + Constant.FILEPREFIX + "?bid=" +
                           bs.getId().longValue() +
                           "'>" + bs.getBoardsName() + "</a>");
          }
          else if (type.equals("move")) {
            writer.println("<input type='radio' name='moveto' value='" +
                           bs.getId().longValue() + "'>" + bs.getBoardsName());

          }
          writer.println("</div>");
          writer.println("</td>");
          if (counter == 1) {
            counter = 0;
            writer.println("</tr>");
          }
          else {
            counter = counter - 1;
          }
        }
        writer.println("</table>");
        writer.println("</td>");
        writer.println("</tr>");
        writer.println("</table>");
      }
    }
    catch (IOException ex) {
    }
    return (SKIP_BODY);
  }

  public String getType() {
    return type;
  }

  public void setType(String type) {
    this.type = type;
  }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -