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

📄 userpictag.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 com.laoer.bbscs.sys.*;
import com.laoer.bbscs.bean.*;
import org.apache.struts.util.RequestUtils;
import org.apache.struts.util.ResponseUtils;

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

  private String scope;
  private String userCheck;

  public UserPicTag() {
  }

  public String getScope() {
    return scope;
  }

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

  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 {
    UserCheck uc = (UserCheck) RequestUtils.lookup(pageContext, userCheck,
        scope);
    /*
      WebApplicationContext wac = WebApplicationContextUtils.
          getRequiredWebApplicationContext(pageContext.getServletContext());*/
    if (uc == null) {
      HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();
      HttpServletResponse response = (HttpServletResponse) pageContext.
          getResponse();
      uc = new UserCheck(request, response);
      //uc = new UserCheck(request, response, wac);
    }
    StringBuffer sb = new StringBuffer();
    if (!uc.isGuest()) {
      UserInfoCache userInfoCache = (UserInfoCache) AppContext.getInstance().
          getAppContext().getBean("userInfoCache");
      //UserInfoCache userInfoCache = (UserInfoCache) wac.getBean("userInfoCache");
      UserInfo ui = userInfoCache.getUserInfoFromCache(uc.getId());

      if (ui != null) {
        if (ui.getHavePic() == 1) {
          sb.append("<a href='");
          sb.append(SysUtil.getUserFileWebPath(ui.getUsername(), uc.getId()));
          sb.append(ui.getPicFileName());
          sb.append("' target='_blank'><img src='");
          sb.append(SysUtil.getUserFileWebPath(ui.getUsername(), uc.getId()));
          sb.append(ui.getPicFileName());
          sb.append("' id='upic_");
          sb.append(uc.getId());
          sb.append("' name='upic_");
          sb.append(uc.getId());
          sb.append("' border='0' class='PIC1' ");
          sb.append("width='117' height='156'>");
          /*
          sb.append("onload='javascript:if(this.width>");
          sb.append(SysInfo.getInstance().getFacewith());
          sb.append("){this.width=");
          sb.append(SysInfo.getInstance().getFacewith());
          sb.append("}if(this.height>");
          sb.append(SysInfo.getInstance().getFacehigh());
          sb.append("){this.height=");
          sb.append(SysInfo.getInstance().getFacehigh());
          sb.append("}'>");*/

          sb.append("</a>");
        }
        else {
          sb.append("<img src='");
          sb.append(Constant.DEFAULTPICURL);
          sb.append("'>");
        }
      }
    }
    else {
      sb.append("<img src='");
      sb.append(Constant.DEFAULTPICURL);
      sb.append("'>");
    }
    ResponseUtils.write(pageContext, sb.toString());
    return (SKIP_BODY);
  }

}

⌨️ 快捷键说明

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