📄 resulttag.java
字号:
package com.trulytech.mantis.tag;
import javax.servlet.jsp.tagext.*;
import java.io.IOException;
import javax.servlet.jsp.JspTagException;
import com.trulytech.mantis.result.DBResult;
/**
* 获得DBResult的各个属性值
* <p>Title: Mantis</p>
*
* <p>Description: </p>
*
* <p>Copyright: Copyright (c) 2002</p>
*
* <p>Company: </p>
*
* @author Wang Xian
* @version 1.0
*/
/*例如************************************
<bean:result name="Result" property="totalPage" />
*******************************************/
public class ResultTag
extends TagSupport {
private String Name = null;
private String Property = null;
public void setName(String Name) {
this.Name = Name;
}
public void setProperty(String Property) {
this.Property = Property;
}
/**
* 覆盖doStartTag方法
* @return int
* @throws JspTagException
*/
public int doStartTag() throws JspTagException {
return EVAL_BODY_INCLUDE;
}
public int doEndTag() throws JspTagException {
try {
if (this.pageContext.findAttribute(Name) != null)
if (this.pageContext.findAttribute(Name) instanceof DBResult) {
if (Property == null)
this.pageContext.getOut().write("");
else if (Property.equalsIgnoreCase("pageSearch"))
this.pageContext.getOut().write( ( (DBResult)this.pageContext.
findAttribute(Name)).pageSearch);
else if (Property.equalsIgnoreCase("TotalPage"))
this.pageContext.getOut().write( ( (DBResult)this.pageContext.
findAttribute(Name)).TotalPage);
else if (Property.equalsIgnoreCase("rowsPerPage"))
this.pageContext.getOut().write( ( (DBResult)this.pageContext.
findAttribute(Name)).rowsPerPage);
else if (Property.equalsIgnoreCase("nextPage"))
this.pageContext.getOut().write( ( (DBResult)this.pageContext.
findAttribute(Name)).nextPage);
else if (Property.equalsIgnoreCase("previousPage"))
this.pageContext.getOut().write( ( (DBResult)this.pageContext.
findAttribute(Name)).previousPage);
else if (Property.equalsIgnoreCase("currentPage"))
this.pageContext.getOut().write( ( (DBResult)this.pageContext.
findAttribute(Name)).currentPage);
else if (Property.equalsIgnoreCase("firstPage"))
this.pageContext.getOut().write( ( (DBResult)this.pageContext.
findAttribute(Name)).firstPage);
else if (Property.equalsIgnoreCase("lastPage"))
this.pageContext.getOut().write( ( (DBResult)this.pageContext.
findAttribute(Name)).lastPage);
else if (Property.equalsIgnoreCase("ColumnCount"))
this.pageContext.getOut().write(String.valueOf( ( (DBResult)this.
pageContext.
findAttribute(Name)).ColumnCount));
else
this.pageContext.getOut().write("");
}
else
this.pageContext.getOut().write("");
else
this.pageContext.getOut().write("");
}
catch (IOException e) {
throw new JspTagException("Fatal error");
}
return EVAL_PAGE;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -