LineClass.java
资源名称:某公司的java培训教材 [点击查看]
上传用户:dinglihq
上传日期:2013-02-04
资源大小:99958k
文件大小:1k
源码类别:
Java编程
开发平台:
Java
- package bible.jsp.tags;
- import javax.servlet.jsp.*;
- import javax.servlet.jsp.tagext.*;
- /**
- * Title: LineClass
- * Description: Tag extension to set determine stylesheet class
- * based upon line number
- * Copyright: Copyright (c) 2001
- * Company: ZeeWare Inc.
- * @author Gary Wells
- * @version 1.0
- */
- public class LineClass extends TagSupport {
- // tag properties
- private int lineNumber;
- private String oddClass;
- private String evenClass;
- // getters and setters
- public int getLineNumber() {
- return lineNumber;
- }
- public void setLineNumber(int lineNumber) {
- this.lineNumber = lineNumber;
- }
- public String getOddClass() {
- return oddClass;
- }
- public void setOddClass(String oddClass) {
- this.oddClass = oddClass;
- }
- public String getEvenClass() {
- return evenClass;
- }
- public void setEvenClass(String evenClass) {
- this.evenClass = evenClass;
- }
- /**
- * Returns the stylesheet class based upon the HTML table line
- * number.
- * @return the desired stylesheet class.
- * @exception JspException
- * @see javax.servlet.jsp.tagext.TagSupport#doStartTag()
- */
- public int doStartTag() throws JspException {
- String className = (lineNumber % 2 == 0 ? evenClass : oddClass);
- pageContext.setAttribute("className", className);
- return EVAL_BODY_INCLUDE;
- }
- }