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

📄 showmyuserinfotag.java

📁 反ajax原代码
💻 JAVA
字号:
// Decompiled by Jad v1.5.7g. Copyright 2000 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/SiliconValley/Bridge/8617/jad.html
// Decompiler options: packimports(3) fieldsfirst ansi 
// Source File Name:   ShowMyUserInfoTag.java

package com.laoer.bbscs.web.tag;

import com.laoer.bbscs.bean.UserInfo;
import com.laoer.bbscs.sys.*;
import com.laoer.bbscs.web.servlet.UserCheck;
import com.laoer.comm.util.FileIO;
import com.laoer.comm.util.Util;
import java.util.Date;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.jsp.JspException;
import javax.servlet.jsp.PageContext;
import javax.servlet.jsp.tagext.TagSupport;
import org.apache.struts.util.*;
import org.springframework.context.support.AbstractApplicationContext;

public class ShowMyUserInfoTag extends TagSupport
{

    private String scope;
    private String name;
    private String type;
    private String userCheck;
    private String form;
    private String property;

    public ShowMyUserInfoTag()
    {
        scope = null;
        name = null;
        type = null;
        userCheck = null;
        form = null;
        property = null;
    }

    public String getScope()
    {
        return scope;
    }

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

    public String getName()
    {
        return name;
    }

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

    public String getType()
    {
        return type;
    }

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

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

    public int doEndTag()
        throws JspException
    {
        UserCheck uc = (UserCheck)RequestUtils.lookup(pageContext, userCheck, scope);
        HttpServletRequest request = (HttpServletRequest)pageContext.getRequest();
        if(uc == null)
        {
            HttpServletResponse response = (HttpServletResponse)pageContext.getResponse();
            if(form == null || property == null)
            {
                uc = new UserCheck(request, response);
            } else
            {
                Object value = RequestUtils.lookup(pageContext, form, property, scope);
                uc = new UserCheck(request, response, ((Long)value).longValue());
            }
        }
        String output = "";
        if(!uc.isGuest())
        {
            Object value = RequestUtils.lookup(pageContext, name, scope);
            UserInfo ui = (UserInfo)value;
            if(ui == null || ui.getId() == null)
            {
                UserInfoCache userInfoCache = (UserInfoCache)AppContext.getInstance().getAppContext().getBean("userInfoCache");
                ui = userInfoCache.getUserInfoFromCache(uc.getId());
            }
            UserLevel ul = SysUtil.getUserLevel(ui.getExp());
            if(type.equals("lastlogintime"))
                output = Util.formatDateTime(new Date(ui.getLastLoginTime()));
            if(type.equals("level"))
                output = ul.getName();
            if(type.equals("hpower"))
                output = String.valueOf(ul.getHpower());
            if(type.equals("pic"))
            {
                StringBuffer sb = new StringBuffer();
                if(ui.getHavePic() == 1)
                {
                    sb.append("<a href='");
                    sb.append(SysUtil.getUserFileWebPath(ui.getUsername(), ui.getId().longValue()));
                    sb.append(ui.getPicFileName());
                    sb.append("' target='_blank'><img src='");
                    sb.append(SysUtil.getUserFileWebPath(ui.getUsername(), ui.getId().longValue()));
                    sb.append(ui.getPicFileName());
                    sb.append("' id='upic_");
                    sb.append(ui.getId().longValue());
                    sb.append("' name='upic_");
                    sb.append(ui.getId().longValue());
                    sb.append("' border=0 ");
                    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("'>");
                }
                output = sb.toString();
            }
            if(type.equals("sign"))
            {
                StringBuffer sb = new StringBuffer();
                sb.append(FileIO.readFile(SysUtil.getUserFilePath(ui.getUsername(), ui.getId().longValue()) + Constant.USERSIGNFILE, Constant.CHARSET));
                sb.append("<input type=\"radio\" name=\"sign\" value=\"\" checked>");
                sb.append(Constant.MESSAGE.getMessage(request.getLocale(), "post.nosign"));
                output = sb.toString();
            }
        } else
        {
            if(type.equals("lastlogintime"))
                output = "";
            UserLevel ul = SysUtil.getUserLevel(0);
            if(type.equals("level"))
                output = ul.getName();
            if(type.equals("hpower"))
                output = "0";
            if(type.equals("pic"))
            {
                StringBuffer sb = new StringBuffer();
                sb.append("<img src='");
                sb.append(Constant.DEFAULTPICURL);
                sb.append("'>");
                output = sb.toString();
            }
        }
        ResponseUtils.write(pageContext, output);
        return 0;
    }

    public String getUserCheck()
    {
        return userCheck;
    }

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

    public String getForm()
    {
        return form;
    }

    public void setForm(String form)
    {
        this.form = form;
    }

    public String getProperty()
    {
        return property;
    }

    public void setProperty(String property)
    {
        this.property = property;
    }
}

⌨️ 快捷键说明

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