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

📄 userfileinposttag.java

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

import javax.servlet.jsp.tagext.TagSupport;
import javax.servlet.jsp.*;
import javax.servlet.http.*;
import com.laoer.bbscs.web.servlet.*;
import org.apache.struts.util.RequestUtils;
import org.apache.struts.util.ResponseUtils;
import com.laoer.bbscs.sys.*;
import com.laoer.comm.util.*;

//import org.springframework.web.context.WebApplicationContext;
//import org.springframework.web.context.support.WebApplicationContextUtils;

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

  private String name = null;
  private String idProperty = null;
  private String nameProperty = null;
  private String userCheck = null;

  public UserFileInPostTag() {
  }

  public String getName() {
    return name;
  }

  public void setName(String name) {
    this.name = name;
  }

  public String getIdProperty() {
    return idProperty;
  }

  public void setIdProperty(String idProperty) {
    this.idProperty = idProperty;
  }

  public String getNameProperty() {
    return nameProperty;
  }

  public void setNameProperty(String nameProperty) {
    this.nameProperty = nameProperty;
  }

  public String getUserCheck() {
    return userCheck;
  }

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

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

  public int doEndTag() throws JspException {
    String output = "";
    HttpServletRequest request = (HttpServletRequest) pageContext.
        getRequest();
    HttpServletResponse response = (HttpServletResponse) pageContext.
        getResponse();
    UserFileInPostCache cache = (UserFileInPostCache) AppContext.getInstance().
        getAppContext().getBean("userFileInPostCache");
    if (userCheck == null || userCheck.length() == 0) {
      if (name != null && idProperty != null && nameProperty != null) {
        Object idvalue =
            RequestUtils.lookup(pageContext, name, idProperty, null);
        Object namevalue =
            RequestUtils.lookup(pageContext, name, nameProperty, null);
        if (idvalue != null && namevalue != null) {
          /*
           String filePath = SysUtil.getUserFilePath(String.valueOf(namevalue),
              ( (Long) idvalue).longValue()) + Constant.USERPOSTFILE;
                     output = FileIO.readFile(filePath, Constant.CHARSET);*/


          output = cache.getUserFileInPostFromCache( ( (Long) idvalue).
              longValue(), String.valueOf(namevalue));

          output = Util.replace(output, "#level#",
                                Constant.MESSAGE.getMessage(request.getLocale(),
              "userinfo.level"));
          output = Util.replace(output, "#article#",
                                Constant.MESSAGE.getMessage(request.getLocale(),
              "userinfo.article"));
          output = Util.replace(output, "#score#",
                                Constant.MESSAGE.getMessage(request.getLocale(),
              "userinfo.score"));

          output = Util.replace(output, "#from#",
                                Constant.MESSAGE.getMessage(request.getLocale(),
              "userinfo.from"));
          output = Util.replace(output, "#register#",
                                Constant.MESSAGE.getMessage(request.getLocale(),
              "userinfo.register"));
        }
        else {
          return (SKIP_BODY);
        }
      }
      else {
        return (SKIP_BODY);
      }
    }
    else {
      UserCheck uc = (UserCheck) RequestUtils.lookup(pageContext, userCheck,
          "request");

      if (uc == null) {
        /*
                 WebApplicationContext wac = WebApplicationContextUtils.
            getRequiredWebApplicationContext(pageContext.getServletContext());
                 uc = new UserCheck(request, response, wac);*/
        uc = new UserCheck(request, response);
      }
      if (!uc.isGuest()) {
        /*
         String filePath = SysUtil.getUserFilePath(uc.getUsername(), uc.getId()) +
            Constant.USERPOSTFILE;
                 output = FileIO.readFile(filePath, Constant.CHARSET);*/
        output = cache.getUserFileInPostFromCache(uc.getId(), uc.getUsername());

        output = Util.replace(output, "#level#",
                              Constant.MESSAGE.getMessage(request.getLocale(),
            "userinfo.level"));
        output = Util.replace(output, "#article#",
                              Constant.MESSAGE.getMessage(request.getLocale(),
            "userinfo.article"));
        output = Util.replace(output, "#score#",
                              Constant.MESSAGE.getMessage(request.getLocale(),
            "userinfo.score"));

        output = Util.replace(output, "#from#",
                              Constant.MESSAGE.getMessage(request.getLocale(),
            "userinfo.from"));
        output = Util.replace(output, "#register#",
                              Constant.MESSAGE.getMessage(request.getLocale(),
            "userinfo.register"));

      }
      else {
        return (SKIP_BODY);
      }
    }
    ResponseUtils.write(pageContext, output);
    return (SKIP_BODY);
  }

}

⌨️ 快捷键说明

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