⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 stockpricehandler.java

📁 java的一系列产品中包括jsme,jmse,j2ee,本文件提供j2ee实现的源代码.
💻 JAVA
字号:
package company;

import javax.servlet.jsp.*;
import javax.servlet.jsp.tagext.*;
import java.util.Hashtable;
import java.io.Writer;
import java.io.IOException;

public class StockPriceHandler extends TagSupport {

public StockPriceHandler() {
	super();
}

/* 
   Called when the container wants to dispose of the current
   tag library. 
*/
public void release() {
	myTickerSymbol = null;
	super.release();
    }


public void setTickerSymbol (String ts) {
	myTickerSymbol=ts;
    }

public String getTickerSymbol () {
	return myTickerSymbol;
    }


public int doStartTag() throws JspException {
/*

  You could place any work that you want to have done here. 
  
  This method returns a status code.  There a number of different
  options for these codes, which are discussed later in this 
  section.  This one instructs WebLogic not to evaluate any 
  expressions inside of the body of the tag.

  At this point, you would insert code to go out and 
  get the stock price from your source.  Take that value and 
  put it into a string variable named 'price'.
*/

  String stockPrice=price;

  try { 

    JspWriter out = pageContext.getOut();
    out.print(myTickerSymbol + ":" + price);

  } catch (Exception e) {
     e.printStackTrace();
     throw new JspException(e.getMessage());
  } 

  return(SKIP_BODY);

}


private String myTickerSymbol;
private String price = "25 cents";

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -