📄 datetimestag.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: DateTimesTag.java
package com.laoer.bbscs.web.tag;
import com.laoer.bbscs.web.servlet.UserCheck;
import java.text.SimpleDateFormat;
import java.util.*;
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.RequestUtils;
import org.apache.struts.util.ResponseUtils;
public class DateTimesTag extends TagSupport
{
private long longTime;
private String style;
private String name;
private String scope;
private String property;
private String userCheck;
public DateTimesTag()
{
longTime = 0L;
style = null;
name = null;
scope = null;
property = null;
userCheck = null;
}
public long getLongTime()
{
return longTime;
}
public void setLongTime(long longTime)
{
this.longTime = longTime;
}
public String getStyle()
{
return style;
}
public void setStyle(String style)
{
this.style = style;
}
public String getName()
{
return name;
}
public void setName(String name)
{
this.name = name;
}
public String getScope()
{
return scope;
}
public void setScope(String scope)
{
this.scope = scope;
}
public String getProperty()
{
return property;
}
public void setProperty(String property)
{
this.property = property;
}
public int doStartTag()
throws JspException
{
return 0;
}
public int doEndTag()
throws JspException
{
if(style == null || style.length() == 0)
style = "yyyy-MM-dd HH:mm:ss";
SimpleDateFormat formatter = new SimpleDateFormat(style);
if(name != null && property != null)
{
Object value = RequestUtils.lookup(pageContext, name, property, scope);
if(value == null)
return 0;
longTime = ((Long)value).longValue();
} else
if(longTime == 0L)
longTime = System.currentTimeMillis();
String output = "";
if(userCheck != null)
{
UserCheck uc = (UserCheck)RequestUtils.lookup(pageContext, userCheck, scope);
if(uc == null)
{
HttpServletRequest request = (HttpServletRequest)pageContext.getRequest();
HttpServletResponse response = (HttpServletResponse)pageContext.getResponse();
uc = new UserCheck(request, response);
}
Calendar c = Calendar.getInstance();
c.setTimeInMillis(longTime);
c.set(14, 0);
c.setTimeZone(TimeZone.getTimeZone(uc.getTimeZone()));
output = formatter.format(c.getTime());
} else
{
output = formatter.format(new Date(longTime));
}
ResponseUtils.write(pageContext, output);
return 0;
}
public String getUserCheck()
{
return userCheck;
}
public void setUserCheck(String userCheck)
{
this.userCheck = userCheck;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -