📄 columntag.java
字号:
package com.trulytech.mantis.tag;
import java.io.*;
import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
import java.util.ArrayList;
import com.trulytech.mantis.result.DBColumn;
/**
*
* <p>Title: Mantis</p>
*
* <p>Description: 根据指定的列值获得DBColumn中的值</p>
*
* <p>Copyright: Copyright (c) 2002</p>
*
* <p>Company: </p>
*
* @author Wang Xian
* @version 1.1
*/
/*例如********************************************************
<bean:foreach name="Result">
<tr>
<td width="100%"><bean:value col="0" /></td>
</tr>
</bean:foreach>
或者
<bean:foreach name="Result">
<tr>
<td width="100%"><bean:value col="0" type="html" /></td>
</tr>
</bean:foreach>
*/
public class ColumnTag
extends TagSupport {
private int Col = 0;
//输出格式
private String Type = "";
/**
* 覆盖doStartTag方法
* @return int
* @throws JspTagException
*/
public int doStartTag() throws JspTagException {
return EVAL_BODY_INCLUDE;
}
/**
* 结束tag
* @return int
* @throws JspTagException
*/
public int doEndTag() throws JspTagException {
try {
if (this.pageContext.findAttribute("array") != null)
if (this.pageContext.findAttribute("array") instanceof ArrayList)
if (Col >= ( (ArrayList)this.pageContext.findAttribute("array")).size())
this.pageContext.getOut().write("");
else
if (Type.equalsIgnoreCase("html"))
this.pageContext.getOut().write(com.trulytech.mantis.system.
Properties.HTMLEncoder( ( (DBColumn) ( (
ArrayList)this.
pageContext.findAttribute("array")).get(Col)).Value));
else
this.pageContext.getOut().write( ( (DBColumn) ( (ArrayList)this.
pageContext.findAttribute("array")).get(Col)).Value);
else
this.pageContext.getOut().write("");
else
this.pageContext.getOut().write("");
}
catch (IOException e) {
throw new JspTagException("Fatal error");
}
return EVAL_PAGE;
}
/**
* 设置列值
* @param Col int
*/
public void setCol(int Col) {
this.Col = Col;
}
public void setType(String Type) {
if (Type == null)
this.Type = "";
else
this.Type = Type;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -