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

📄 leftboardtag.java

📁 spring+struts+hibernate做的银行系统
💻 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 org.springframework.web.context.WebApplicationContext;
//import org.springframework.web.context.support.WebApplicationContextUtils;
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;

/**
 * <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 LeftBoardTag
    extends TagSupport {

  private String scope;
  private String userCheck;
  private String userInfo;

  public LeftBoardTag() {
  }

  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 String getScope() {
    return scope;
  }

  public void setScope(String scope) {
    this.scope = scope;
  }

  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();
    if (scope == null || scope.length() == 0) {
      scope = "request";
    }
    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);

    //IBoardsService ibs = (IBoardsService) wac.getBean("boardsService");
    //BoardList boardList = (BoardList) wac.getBean("boradList");

    IBoardsService ibs = (IBoardsService) AppContext.getInstance().
        getAppContext().getBean("boardsService");
    BoardList boardList = (BoardList) AppContext.getInstance().getAppContext().
        getBean("boradList");

    Board b = null;
    Map map = null;
    Boards bs = null;
    try {
      for (int i = 0; i < boardList.getBoradList().size(); i++) {
        b = (Board) boardList.getBoradList().get(i);
        writer.print("<div id=\"CD" + b.getId().longValue() +
                     "Parent\" class=\"parent\">\n");
        writer.print("<a href=\"#\" onClick=\"expandIt('CD" +
                     b.getId().longValue() + "',img" + b.getId().longValue() +
                     "); return false\"><img id=\"img" + b.getId().longValue() +
                     "\" " + " src='images/line_01_copy.gif' width='18' height='16' align='absmiddle' border=0>" +
                     "<img src='images/folder_01_copy.gif' align='absmiddle' border=0>" +
                     b.getBoardName() + "</a>\n");
        writer.print("</div>\n<div id=\"CD" + b.getId().longValue() +
                     "Child\" class=\"child\">\n");
        map = b.getBoards();
        if (map != null) {
          int boardsnum = map.size();
          int j = 1;
          Iterator it = map.values().iterator();
          while (it.hasNext()) {
            bs = (Boards) it.next();
            if (bs.getUseStat() == 1) {
              if (ibs.isCanInBoards(bs, uc)) {
                if (j == boardsnum) {
                  writer.print("<img src='images/line_06_copy.gif' width='37' height='16' align='absmiddle' border=0><a href='" +
                               config.getPrefix() + "forum" +
                               Constant.FILEPREFIX + "?bid=" +
                               bs.getId().longValue() +
                               "' target='bbscs_mainFrame'>" +
                               bs.getBoardsName() + "</a><br>\n");
                }
                else {
                  writer.print("<img src='images/line_05_copy.gif' width='37' height='16' align='absmiddle' border=0><a href='" +
                               config.getPrefix() + "forum" +
                               Constant.FILEPREFIX + "?bid=" +
                               bs.getId().longValue() +
                               "' target='bbscs_mainFrame'>" +
                               bs.getBoardsName() + "</a><br>\n");
                }
                j++;
              }
              else {
                boardsnum--;
                continue;
              }
            }
            else {
              boardsnum--;
              continue;
            }

          }
        }
        writer.print("</div>\n");
      }
      //writer.print();
    }
    catch (Exception e) {
    }
    return (SKIP_BODY);
  }

}

⌨️ 快捷键说明

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