jsp使用自定义标签taglib分页系列——DrilldownTag.java

15 篇文章 0 订阅

package com.avantouch.common.web.struts.taglib;

import javax.servlet.jsp.JspException;

import org.apache.struts.util.RequestUtils;
import org.apache.struts.util.ResponseUtils;

/**
 * <p>Title DrilldownTag.java</p>
 * <p>Description  </p>
 * <p>Copyright:  Copyright (c) 2004 AvanTouch,Inc</p>
 * <p>Company:  AvanTouch,Inc</p>
 * @author:  david 2004-12-7
 * @modifier:
 * @version  1.0
 */
public class DrilldownTag extends ContentBase {

 private String link = null;
 private String name = null;
 private String property = null;
 private String method = "details";

 /**
 * The scope of the bean specified by the name property, if any.
 */
 protected String scope = null;

 public int doStartTag() throws JspException {
  writeTDHeaders();
  writeHyperlink();
  return (SKIP_BODY);
 }

 public int doEndTag() throws JspException {
  writeTDEnd();
  release();
  // Continue processing this page
  return (EVAL_PAGE);
 }

 /**
  * write  hyperlink
  * p><code>writeHyperlink</code></p>
  * @throws JspException
  * @author david 2004-12-7
  * @Since 1.0
  */
 public void writeHyperlink() throws JspException {
  Object value = null;
  if (name != null) {
   value = RequestUtils.lookup(pageContext, name, property, scope);   
  } else {
   value = property;
  }
  link = link + "?method=" + method + "&key=" + value;
  StringBuffer buf = new StringBuffer("<A");
  buf.append("  href=/"" + link + "/"");
  if (getTitle() != null) {
   buf.append("  TITLE=/"" + getTitle() + "/"");
  } else {
   buf.append("  TITLE=/"look particular record/"");
  }
  prepareEvents(buf);
  buf.append(">");
  buf.append(value);
  buf.append("</A>");
  ResponseUtils.write(pageContext, buf.toString());
 } // end writeHyperlink

 /**
  * Release all allocated resources.
  */
 public void release() {
  super.release();
  link = null;
  name = null;
  property = null;
  scope = null;
 }

 public String getLink() {
  return link;
 }

 public String getName() {
  return name;
 }

 public String getProperty() {
  return property;
 }

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

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

 public String getScope() {
  return scope;
 }

 public void setLink(String action) {
  this.link = action;
 }

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

 public String getMethod() {
  return method;
 }

 public void setMethod(String string) {
  method = string;
 }

}
 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值